Having an Object3D
with various levels of children (more Object3Ds or Meshes/Lines), I am trying to compute a bounding box of the object and all its descendants similar to the setFromObject()
method in the Box3
class.
Unfortunately, I can't utilize the setFromObject()
method of Box3
because the project I'm working on exclusively uses BufferGeometry
instead of Geometry
. Since BufferGeometry
objects lack a .vertices
property, the setFromObject()
function is unable to compute the bounding box as intended.
var bbox = new THREE.Box3().setFromObject(object);
console.log(bbox.min); // x, y, and z are all Infinity.
console.log(bbox.max); // x, y, and z are all -Infinity.
While attempting to use the computeBoundingBox()
method of BufferGeometry
, I have found that the bounding box does not update when the geometry is manipulated. This issue may be linked to matrixAutoUpdate
being set to false
, despite trying to invoke updateMatrix()
with no success.
Is there a method to calculate a bounding box for an Object3D
and all its descendants using the BufferGeometry
class? As a newcomer to Three.js, any guidance on this matter would be greatly appreciated!
My current Three.js version is r66.