Modify default XRExperience Pointer

Hello there,

I have a game, where you select meshes via gaze WebXRPointerSelection. It is working very well but I would love to have a more recognizable Pointer as my space is big and the little white dot is not very recognizable. xr.pointerSelection.laserPointerDefaultColor allows for some modification, but even if it is red it is small.

So I dug a little bit into the code. First I think the documentation is out of date or maybe I messed something up, because WebXRDefaultExperienceOptions shows pointerSelectionOptions, but it is not available as option as I believe I saw the teleportation and pointer selection are automatic features of the baseExperience.

https://playground.babylonjs.com/#H414LP#2

To come to the point, I noticed the controller with the pointer name "controller-0-gaze-none". In my playground it is called "controller-1-gaze-none-pointer" (through USB-debugging). I think this is the pointer mesh which moves with your gaze, right?

I tried to manipulate this mesh by changing the scaling, but as the inspector suggests it is not a public property without setter. So how can I manipulate this very pointer or make my own one?

Any feedback is welcome :slight_smile: (as I believe my code could be better organized in Babylon js style)

1 Like

Hey,

You have found the one mesh I (for some reason?) didn’t provide a method to override…

Yes, this is the right mesh, but it will be hard to programatically change it, because it is created for each controller added and might have a different name every time. The laser pointer’s material can be provided using the options, but not the selection mesh itself.

Want to submit an issue on github? I will try finding time and add that option. Of course, if you want to submit a PR I will be more than happy to approve and merge it :slight_smile:

2 Likes

Catching up on this one - the PR is available - [XR] allow mesh customization in pointer selection by RaananW · Pull Request #11493 · BabylonJS/Babylon.js (github.com) , this will allow you to provide a function that will generate the selection mesh instead of the default one.

Hope this helps! :slight_smile:

1 Like