@@ -54,10 +54,10 @@
<h2>Methods</h2>
<div>See the base [page:LineSegments] class for common methods.</div>
- <h3>[method:null update]( [page:Object3D object] )</h3>
+ <h3>[method:null update]()</h3>
<div>
Updates the helper's geometry to match the dimensions of the
- of the passed object, including any children. See [page:Box3.setFromObject].
+ of the object, including any children. See [page:Box3.setFromObject].
</div>
<h2>Source</h2>
@@ -6,10 +6,13 @@ import { BufferGeometry } from '../core/BufferGeometry';
/**
* @author mrdoob / http://mrdoob.com/
+ * @author Mugen87 / http://github.com/Mugen87
*/
function BoxHelper( object, color ) {
+ this.object = object;
+
if ( color === undefined ) color = 0xffff00;
var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
@@ -21,11 +24,9 @@ function BoxHelper( object, color ) {
LineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) );
- if ( object !== undefined ) {
-
- this.update( object );
+ this.matrixAutoUpdate = false;
- }
+ this.update();
}
@@ -38,15 +39,15 @@ BoxHelper.prototype.update = ( function () {
return function update( object ) {
- if ( object && object.isBox3 ) {
+ if ( object !== undefined ) {
- box.copy( object );
+ console.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );
- } else {
+ }
- box.setFromObject( object );
+ this.object.updateMatrixWorld( true );
+ box.setFromObject( this.object );
if ( box.isEmpty() ) return;
@@ -83,7 +84,7 @@ BoxHelper.prototype.update = ( function () {
position.needsUpdate = true;
- this.geometry.computeBoundingSphere();
+ return this;
};