Download node_modules/three/examples/jsm/misc/Gyroscope.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/examples/jsm/misc/Gyroscope.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/examples/jsm/misc/Gyroscope.js
-
curl -L -o Gyroscope.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/examples/jsm/misc/Gyroscope.js
1.19 kB
| import { | |
| Object3D, | |
| Quaternion, | |
| Vector3 | |
| } from 'three'; | |
| const _translationObject = new Vector3(); | |
| const _quaternionObject = new Quaternion(); | |
| const _scaleObject = new Vector3(); | |
| const _translationWorld = new Vector3(); | |
| const _quaternionWorld = new Quaternion(); | |
| const _scaleWorld = new Vector3(); | |
| class Gyroscope extends Object3D { | |
| constructor() { | |
| super(); | |
| } | |
| updateMatrixWorld( force ) { | |
| this.matrixAutoUpdate && this.updateMatrix(); | |
| // update matrixWorld | |
| if ( this.matrixWorldNeedsUpdate || force ) { | |
| if ( this.parent !== null ) { | |
| this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); | |
| this.matrixWorld.decompose( _translationWorld, _quaternionWorld, _scaleWorld ); | |
| this.matrix.decompose( _translationObject, _quaternionObject, _scaleObject ); | |
| this.matrixWorld.compose( _translationWorld, _quaternionObject, _scaleWorld ); | |
| } else { | |
| this.matrixWorld.copy( this.matrix ); | |
| } | |
| this.matrixWorldNeedsUpdate = false; | |
| force = true; | |
| } | |
| // update children | |
| for ( let i = 0, l = this.children.length; i < l; i ++ ) { | |
| this.children[ i ].updateMatrixWorld( force ); | |
| } | |
| } | |
| } | |
| export { Gyroscope }; | |