Skip to content

how to get bounding box by document #529

Answered by donmccurdy
qiangwai asked this question in Q&A
Discussion options

You must be logged in to vote

The bounds(object) function can be used to compute the bounding box (AABB) of a Node or Scene:

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]}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by donmccurdy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants