Removing ray to motionController within WebXR

Hi,
I would like to change the motionController in particular occasions.
I used visibility on the rootMesh and children, but the ray is still visible (not a child, I suppose).
Any idea on how to do it ?

I made a playground to illustrate : the right controller is changed to a sphere when the “squeeze” button is pressed (I’m using chrome xr module)
https://playground.babylonjs.com/#HY823G#6

Thankx in advance

Michel

You can disable the ray (i.e. disable the pointer selection feature) if you don’t use it. If you do uise it and only want to set the ray to be invisible (but still active) you can set it using this property:

WebXRControllerPointerSelection | Babylon.js Documentation (babylonjs.com)

You can get the pointer selection feature directly from the default xr helper (xr.pointerSelection)

I used :
pointerSelection.displayLaserPointer = false;
pointerSelection.disablePointerLighting = false;

and there are 2 problems :

  • when using glowLayer, we can see that the pointer lightning still appears on the target when the controller moves (and disappears when it stops)
  • after restoring to true, the beam only appears when the controller is moving

I’ve updated the playground to illustrate (with a cube to show the pointer lightning) :
https://playground.babylonjs.com/#HY823G#7

I’m also trying to disable/enable the pointer feature, but I have several errors. I’m investigating because I’m probably doing it wrong.

call pointerSelection.detach() for temporary, or disable the feature using the features manager for a long-term removal

this sounds like a bug, but i’ll have to check.

I assume you mean the target? you will need to disable displaySelectionMesh to remove that as well.

Thanks for your quick answer.
Adding displaySelectionMesh = false solve my problem when using the oculus quest 2.
I should test more, but it seems that most of the problems I encounter are linked to the WebXR chrome module rather than babylonjs itself.

2 Likes