Capítulo 320 de 859
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 );
Constructor
| Signature |
|---|
| `new BoxHelper( object : Object3D, color : number |
Properties
| Property | Description |
|---|---|
.object : Object3D | The 3D object being visualized. |
Methods
| Method | Description |
|---|---|
.dispose() | Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. |
.setFromObject( object : Object3D ) : BoxHelper | Updates the wireframe box for the passed object. |
.update() | Updates the helper's geometry to match the dimensions of the object, including any children. |