how to get bounding box by document #529
-
I want to use this SDK to compute gltf bounding-box in node environment,like threejs : |
Beta Was this translation helpful? Give feedback.
Answered by
donmccurdy
Mar 24, 2022
Replies: 1 comment
-
The import { bounds } from '@gltf-transform/functions';
const root = document.getRoot();
const scene = root.getDefaultScene() || root.listScenes()[0];
const bbox = bounds(scene);
console.log(bbox); // → {min: [-1, -1, -1], max: [1, 1, 1]} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
donmccurdy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
bounds(object)
function can be used to compute the bounding box (AABB) of a Node or Scene: