Hi,
I’m working on a WebXR project that uses hand tracking, with gestures that requires 2 hands. By default, it switches the hand that controls the pointer as soon as I pinch. I would like it to still do this, but only if I’m not pinching with 2 hands.
Also, the new Quest update makes it so that if you’re only holding one controller, it will use hand tracking for the other hand. When that is the case, I would prefer if only the controller was able to control the pointer.
So, is there a way to manually set the active controller?
@RaananW
cc @RaananW (please be patient, Raanan is out on well deserved vacations)
1 Like
Thank you for letting me know. He has been very active, so that’s well deserved indeed.
Hi!
Yes and no? But this is a matter of implementation, so it can be changed.
What you can do is either turn selection on both controllers using this option - Babylon.js docs
or set your preferred handedness using this option:
https://doc.babylonjs.com/typedoc/interfaces/BABYLON.IWebXRControllerPointerSelectionOptions#preferredHandedness
There is no option to change it in realtime, but I don’t see a reason not to add that as a public flag to the pointer selection feature. If I understand correctly, you want to be able to manually set which controller has pointer selection turned on, right?
Welcome back
Yes, being able to manually set it would be great!
Also, while I’m at it, I would like to ask if there is a way to override the pointer direction?
I’m using the pointer for selecting objects to drag around in the world. When I use hand tracking, as I pull my hand towards my body to bring the object closer to me, the pointer ends up pointing towards the ground, which makes it a bit awkward to move things.
If there’s no way to override it, it would be fantastic if there were an option in pointerSelectionOptions, which could be called overridePointerDirection.
A suggestion would be for it to be a callback function, which takes the original direction of the pointer, the position where the ray starts, as well as the controller as arguments. The returned value would be the pointer direction that would be applied.
1 Like
The pointer direction comes from webxr directly - this is what your device defines as the direction of the pointer. it is device/controller type dependent. But I totally get what you are saying. I had once a playground where i really wanted to change the pointer direction, but ended up manipulating the model I used instead of changing it. Let me think how possible it is!
As to the pointer selection _ i opened an issue for it - [XR] Allow choosing which hand/controller controls pointer selection while in session · Issue #15345 · BabylonJS/Babylon.js (github.com)
Thank you for picking this up!
And thanks for the explanation regarding the pointer. Since it’s not calculated by Babylon, it makes a lot of sense that an option isn’t available at the moment.
The way I do dragging, is that I hide the laser during drag, that way I can apply smoothing to the object that is being moved, without the laser appearing to be off. I thought about the idea of calculating the drag offset myself, instead of using the pointer while dragging, but then when you release, the laser wouldn’t be pointing towards the object.
1 Like