How to pull an object from far to close in WebXR with Joystick

https://playground.babylonjs.com/#YEZPVT#968
This demo works fine with mouse, and I want to achieve the same function in WebXR mode, in WebXR mode, I want to pull the sphere with Joystick, not mouse.

I just want to manipulate the distance to the ball, when change the distance to the ball, need keep the distance of the box constant.

I want to push or pull the sphere with the ‘xr-standard-thumbstick’ (as the following pic) of my vr glasses in WebXR mode,

how could I modify the code?

@RaananW our XR guru is currently in vacation but will definitely have a look after the break.

Maybe @carolhmj knows where it is in the doc

1 Like

Seems to be here WebXR Controllers Support | Babylon.js Documentation (babylonjs.com) :smiley:

2 Likes

Thanks @carolhmj .

Yes, I have read this document. By reading this document again, I have a deeper understanding of it, but I am still not sure whether there is a direct configuration to achieve such a requirement:

The current situation is that I click the sphere and approach from the edge of the sphere to the center to narrow the distance of the sphere; and what I want is: point to the sphere, pressed the ‘xr-standard-trigger’ button, then pull the ‘xr-standard-thumbstick’ to change its yAxis to narrow the distance.

You might find this demo interesting - Babylon VR rythym | Babylon.js Playground (babylonjs.com) . This allows you to grab and place objects. what you will need to add yourself is the callback that listens to the axis change(s) and rotate the selected mesh. There is no standard implementation for this.

2 Likes