Browse Source

Update to cascade behavior from scene.pointerMovePredicate to raySelectionPredicate

Michael Smith 5 năm trước cách đây
mục cha
commit
d170f2083c
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      src/XR/features/WebXRControllerPointerSelection.ts

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

@@ -163,7 +163,8 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
     public selectionMeshPickedColor: Color3 = new Color3(0.3, 0.3, 1.0);
 
     /**
-     * To be optionaly changed by user to define custom ray selection
+     * Optional filter to be used for ray selection.  This predicate shares behavior with
+     * scene.pointerMovePredicate which takes priority if it is also assigned.
      */
     public raySelectionPredicate: (mesh: AbstractMesh) => boolean;
 
@@ -253,7 +254,8 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
 
             // Every frame check collisions/input
             controllerData.xrController.getWorldPointerRayToRef(controllerData.tmpRay);
-            controllerData.pick = this._scene.pickWithRay(controllerData.tmpRay, this.raySelectionPredicate);
+            controllerData.pick = this._scene.pickWithRay(controllerData.tmpRay,
+                this._scene.pointerMovePredicate || this.raySelectionPredicate);
 
             const pick = controllerData.pick;