소스 검색

Don't cast XRRigidTransform's position and orientation directly to Babylon Vector3 and Quaternion as these are incompatible types instead use Set to directly set the properties.

Alex Tran 5 년 전
부모
커밋
938e8f848d
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/XR/features/WebXRHitTest.ts

+ 4 - 2
src/XR/features/WebXRHitTest.ts

@@ -226,8 +226,10 @@ export class WebXRHitTest extends WebXRAbstractFeature implements IWebXRHitTestF
             if (!pose) {
                 return;
             }
-            this._tmpPos.copyFrom(pose.transform.position as unknown as Vector3);
-            this._tmpQuat.copyFrom(pose.transform.orientation as unknown as Quaternion);
+            const pos = pose.transform.position;
+            const quat = pose.transform.orientation;
+            this._tmpPos.set(pos.x, pos.y, pos.z);
+            this._tmpQuat.set(quat.x, quat.y, quat.z, quat.w);
             Matrix.FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, this._tmpMat);
             if (!this._xrSessionManager.scene.useRightHandedSystem) {
                 this._tmpPos.z *= -1;