File: BoxHelper.md | Updated: 11/15/2025
Helper object to graphically show the world-axis-aligned bounding box around an object. The actual bounding box is handled with Box3, this is just a visual helper for debugging. It can be automatically resized with BoxHelper#update when the object it's created from is transformed. Note that the object must have a geometry for this to work, so it won't work with sprites.
const sphere = new THREE.SphereGeometry();
const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
const box = new THREE.BoxHelper( object, 0xffff00 );
scene.add( box );
Constructs a new box helper.
object | The 3D object to show the world-axis-aligned bounding box.
---|---
color | The box's color. Default is 0xffff00.
The 3D object being visualized.
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
Updates the wireframe box for the passed object.
object | The 3D object to create the helper for.
---|---
Returns: A reference to this instance.
Updates the helper's geometry to match the dimensions of the object, including any children.