diff --git a/src/core/Object3D.js b/src/core/Object3D.js index f5670eeb43b96ee4e50aa2337ca0ad812c3fa0b9..658659f4af76ff6bc85c00125f8495589e008835 100644 --- a/src/core/Object3D.js +++ b/src/core/Object3D.js @@ -92,6 +92,18 @@ THREE.Object3D.prototype = { }, + localToWorld: function ( vector ) { + + return this.matrixWorld.multiplyVector3( vector ); + + }, + + worldToLocal: function ( vector ) { + + return THREE.Object3D.__m1.getInverse( this.matrixWorld ).multiplyVector3( vector ); + + }, + lookAt: function ( vector ) { // TODO: Add hierarchy support. @@ -206,7 +218,7 @@ THREE.Object3D.prototype = { return undefined; }, - + getDescendants: function ( array ) { if ( array === undefined ) array = []; @@ -218,22 +230,22 @@ THREE.Object3D.prototype = { this.children[ i ].getDescendants( array ); }; - + return array; - + }, updateMatrix: function () { this.matrix.setPosition( this.position ); - if ( this.useQuaternion === true ) { + if ( this.useQuaternion === false ) { - this.matrix.setRotationFromQuaternion( this.quaternion ); + this.matrix.setRotationFromEuler( this.rotation, this.eulerOrder ); } else { - this.matrix.setRotationFromEuler( this.rotation, this.eulerOrder ); + this.matrix.setRotationFromQuaternion( this.quaternion ); } @@ -254,13 +266,13 @@ THREE.Object3D.prototype = { if ( this.matrixWorldNeedsUpdate === true || force === true ) { - if ( this.parent !== undefined ) { + if ( this.parent === undefined ) { - this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix ); + this.matrixWorld.copy( this.matrix ); } else { - this.matrixWorld.copy( this.matrix ); + this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix ); } @@ -280,18 +292,6 @@ THREE.Object3D.prototype = { }, - worldToLocal: function ( vector ) { - - return THREE.Object3D.__m1.getInverse( this.matrixWorld ).multiplyVector3( vector ); - - }, - - localToWorld: function ( vector ) { - - return this.matrixWorld.multiplyVector3( vector ); - - }, - clone: function () { // TODO