瀏覽代碼

fix for undefined rotation of rig camera

Raanan Weber 5 年之前
父節點
當前提交
ccaccc6c82
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/XR/webXRCamera.ts

+ 5 - 2
src/XR/webXRCamera.ts

@@ -179,8 +179,11 @@ export class WebXRCamera extends FreeCamera {
                 }
             }
             // Update view/projection matrix
-            currentRig.position.copyFrom(view.transform.position);
-            currentRig.rotationQuaternion.copyFrom(view.transform.orientation);
+            const pos = view.transform.position;
+            const orientation = view.transform.orientation;
+
+            currentRig.position.set(pos.x, pos.y, pos.z);
+            currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);
             if (!this._scene.useRightHandedSystem) {
                 currentRig.position.z *= -1;
                 currentRig.rotationQuaternion.z *= -1;