소스 검색

Merge pull request #8993 from RaananW/smallDirectTeleportationFix

[XR] Fix teleportation blockers for direct lines
David Catuhe 4 년 전
부모
커밋
d5cf4f1ff4
1개의 변경된 파일6개의 추가작업 그리고 8개의 파일을 삭제
  1. 6 8
      src/XR/features/WebXRControllerTeleportation.ts

+ 6 - 8
src/XR/features/WebXRControllerTeleportation.ts

@@ -359,20 +359,19 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
                 controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);
                 // pick grounds that are LOWER only. upper will use parabolic path
                 let pick = scene.pickWithRay(this._tmpRay, (o) => {
-                    const index = this._floorMeshes.indexOf(o);
-                    if (index === -1) {
-                        return false;
-                    }
                     // check for mesh-blockers
                     if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {
                         return true;
                     }
+                    const index = this._floorMeshes.indexOf(o);
+                    if (index === -1) {
+                        return false;
+                    }
                     return this._floorMeshes[index].absolutePosition.y < this._options.xrInput.xrCamera.position.y;
                 });
                 if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {
                     return;
-                }
-                if (pick && pick.pickedPoint) {
+                } else if (pick && pick.pickedPoint) {
                     hitPossible = true;
                     this._setTargetMeshPosition(pick.pickedPoint);
                     this._setTargetMeshVisibility(true);
@@ -399,8 +398,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
                         });
                         if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {
                             return;
-                        }
-                        if (pick && pick.pickedPoint) {
+                        } else if (pick && pick.pickedPoint) {
                             hitPossible = true;
                             this._setTargetMeshPosition(pick.pickedPoint);
                             this._setTargetMeshVisibility(true);