2
0

Gyroscope.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. console.warn( "THREE.Gyroscope: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation." );
  2. THREE.Gyroscope = function () {
  3. THREE.Object3D.call( this );
  4. };
  5. THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
  6. THREE.Gyroscope.prototype.constructor = THREE.Gyroscope;
  7. THREE.Gyroscope.prototype.updateMatrixWorld = ( function () {
  8. var translationObject = new THREE.Vector3();
  9. var quaternionObject = new THREE.Quaternion();
  10. var scaleObject = new THREE.Vector3();
  11. var translationWorld = new THREE.Vector3();
  12. var quaternionWorld = new THREE.Quaternion();
  13. var scaleWorld = new THREE.Vector3();
  14. return function updateMatrixWorld( force ) {
  15. this.matrixAutoUpdate && this.updateMatrix();
  16. // update matrixWorld
  17. if ( this.matrixWorldNeedsUpdate || force ) {
  18. if ( this.parent !== null ) {
  19. this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
  20. this.matrixWorld.decompose( translationWorld, quaternionWorld, scaleWorld );
  21. this.matrix.decompose( translationObject, quaternionObject, scaleObject );
  22. this.matrixWorld.compose( translationWorld, quaternionObject, scaleWorld );
  23. } else {
  24. this.matrixWorld.copy( this.matrix );
  25. }
  26. this.matrixWorldNeedsUpdate = false;
  27. force = true;
  28. }
  29. // update children
  30. for ( var i = 0, l = this.children.length; i < l; i ++ ) {
  31. this.children[ i ].updateMatrixWorld( force );
  32. }
  33. };
  34. }() );