react-xr icon indicating copy to clipboard operation
react-xr copied to clipboard

Pinch Gestures

Open boehm-e opened this issue 2 years ago • 5 comments

Hi,

I would like to implement pinch to zoom, Is it something possible with this lib ? Maybe with useXREvent

Thank you

boehm-e avatar May 17 '22 11:05 boehm-e

There's https://github.com/stewdio/handy.js

saitonakamura avatar May 17 '22 11:05 saitonakamura

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)

boehm-e avatar May 17 '22 11:05 boehm-e

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.

CodyJasonBennett avatar Jun 20 '22 09:06 CodyJasonBennett

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

AdaRoseCannon avatar Jun 24 '22 10:06 AdaRoseCannon

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

AdaRoseCannon avatar Jun 24 '22 10:06 AdaRoseCannon