Skip to content

Commit 67b2133

Browse files
authored
Refactor pointer selection logic to use continue instead of return (#16802)
Move to for instead of forEach required changing the return statements to continue. See https://forum.babylonjs.com/t/webxr-controller-ray/59069?u=raananw
1 parent 1da9b3c commit 67b2133

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/dev/core/src/XR/features/WebXRControllerPointerSelection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
420420
// only do this for the selected pointer
421421
const controllerData = this._controllers[id];
422422
if (this._options.lookAndPickMode && controllerData.xrController?.inputSource.targetRayMode !== "transient-pointer") {
423-
return;
423+
continue;
424424
}
425425
if ((!this._options.enablePointerSelectionOnAllControllers && id !== this._attachedController) || controllerData.disabledByNearInteraction) {
426426
controllerData.selectionMesh.isVisible = false;
427427
controllerData.laserPointer.isVisible = false;
428428
controllerData.pick = null;
429-
return;
429+
continue;
430430
}
431431

432432
controllerData.laserPointer.isVisible = this.displayLaserPointer;
@@ -444,7 +444,7 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
444444
controllerGlobalPosition = controllerData.webXRCamera.position;
445445
controllerData.webXRCamera.getForwardRayToRef(controllerData.tmpRay);
446446
} else {
447-
return;
447+
continue;
448448
}
449449

450450
if (this._options.maxPointerDistance) {

0 commit comments

Comments
 (0)