|
@@ -13,8 +13,8 @@
|
|
|
<h1>[name]</h1>
|
|
|
|
|
|
<p class="desc">
|
|
|
- Helper object to show the world-axis-aligned bounding box around an object.
|
|
|
- It can be used in synergy with [page:Box3] items in order to easily compute world-axis-aligned bounding boxes for objects, and use them for fast collision detection. See [page:Box3.intersect].
|
|
|
+ Helper object to graphically show the world-axis-aligned bounding box around an object. The actual bounding box is handled with [page:Box3], this is just a visual helper for debugging.
|
|
|
+ It can be automatically resized with the [page:BoxHelper.update] method when the object it's created from is transformed.
|
|
|
Note that the object must have a [page:Geometry] or [page:BufferGeometry] for this to work,
|
|
|
so it won't work with [page:Sprite Sprites].
|
|
|
</p>
|
|
@@ -38,15 +38,15 @@
|
|
|
|
|
|
// Creating the actual bounding box (on which we can test intersection with other Box3 objects)
|
|
|
var box3 = new THREE.Box3();
|
|
|
- // Shape and position the box after the helper
|
|
|
- box3.setFromObject( helper );
|
|
|
+ // Shape and position the box after the object
|
|
|
+ box3.setFromObject( sphere );
|
|
|
|
|
|
// Let's move the sphere
|
|
|
sphereObject.position.set( 7, 7, 7 );
|
|
|
|
|
|
- // Whenever the object is moved or rotated or scaled:
|
|
|
+ // Whenever the object is moved or rotated or scaled, we update both the bounding box and the helper
|
|
|
helper.update();
|
|
|
- box3.setFromObject( helper );
|
|
|
+ box3.setFromObject( sphereObject );
|
|
|
</code>
|
|
|
|
|
|
|