在 Three.js 中访问 VR 耳机方向
Access VR headset orientation in Three.js
如何在 Three.js 中访问 VR 耳机方向? WebXRManager 似乎没有提供执行此操作的方法。
您可以从用于渲染场景的相机中提取方向。演示时尝试以下操作:
const position = new THREE.Vector3();
const rotation = new THREE.Quaternion();
const scale = new THREE.Vector3();
// the following line extracts the position, rotation and scale in world space
camera.matrixWorld.decompose( position, rotation, scale );
如何在 Three.js 中访问 VR 耳机方向? WebXRManager 似乎没有提供执行此操作的方法。
您可以从用于渲染场景的相机中提取方向。演示时尝试以下操作:
const position = new THREE.Vector3();
const rotation = new THREE.Quaternion();
const scale = new THREE.Vector3();
// the following line extracts the position, rotation and scale in world space
camera.matrixWorld.decompose( position, rotation, scale );