瀏覽代碼

Merge pull request #8425 from Alex-MSFT/WebXR_cast_Fix

Fix bug in WebXRHit test due to directly casting to Babylon types
Raanan Weber 5 年之前
父節點
當前提交
235fd9542b
共有 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) {
             if (!pose) {
                 return;
                 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);
             Matrix.FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, this._tmpMat);
             if (!this._xrSessionManager.scene.useRightHandedSystem) {
             if (!this._xrSessionManager.scene.useRightHandedSystem) {
                 this._tmpPos.z *= -1;
                 this._tmpPos.z *= -1;