Просмотр исходного кода

fix for undefined rotation of rig camera

Raanan Weber 5 лет назад
Родитель
Сommit
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;