/** * @author alteredq / http://alteredqualia.com/ */ THREE.Gyroscope = function () { THREE.Object3D.call( this ); }; THREE.Gyroscope.prototype = new THREE.Object3D(); THREE.Gyroscope.prototype.constructor = THREE.Gyroscope; THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) { this.matrixAutoUpdate && this.updateMatrix(); // update matrixWorld if ( this.matrixWorldNeedsUpdate || force ) { if ( this.parent ) { this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix ); this.matrixWorld.decompose( this.translationWorld, this.rotationWorld, this.scaleWorld ); this.matrix.decompose( this.translationObject, this.rotationObject, this.scaleObject ); this.matrixWorld.compose( this.translationWorld, this.rotationObject, this.scaleWorld ); } else { this.matrixWorld.copy( this.matrix ); } this.matrixWorldNeedsUpdate = false; force = true; } // update children for ( var i = 0, l = this.children.length; i < l; i ++ ) { this.children[ i ].updateMatrixWorld( force ); } }; THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3(); THREE.Gyroscope.prototype.translationObject = new THREE.Vector3(); THREE.Gyroscope.prototype.rotationWorld = new THREE.Quaternion(); THREE.Gyroscope.prototype.rotationObject = new THREE.Quaternion(); THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3(); THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3();