react-xr
react-xr copied to clipboard
Pinch Gestures
Hi,
I would like to implement pinch to zoom,
Is it something possible with this lib ? Maybe with useXREvent
Thank you
There's https://github.com/stewdio/handy.js
Thank you for your answer @saitonakamura I was not clear, I am looking for a way for a user to scale a 3d model by pinching the touch screen. I do not see any events allowing me to do that withing this library (same for pmndrs/drei and react-three-fiber)
Pinching is built-in to three's XRController (you'd access it under hand.inputState.pinching
via gl.xr.getHand(index)
or XRController.hand
). This should hopefully suit your case, but it's very limited elsewhere.
An implementation like https://github.com/AdaRoseCannon/handy-work would be better suited for hand gestures, but this would have to come in 4.x.
I need to record some pinch poses for that for people to use, if you do make some yourself please add them to the repo
for interactions on the 2D screen you can listen for selectstart events you can get the position of the finger in 3D space by getting the target Ray space position.
if you get a selectstart then another before a selected then two fingers are down in this situation the user is pinching