viromedia / viro

ViroReact: AR and VR using React Native
MIT License
2.29k stars 481 forks source link

how to prevent onDrag event automatically dragging object + And not have the gyroscope to control the view of the user #200

Closed dominicrico closed 6 years ago

dominicrico commented 6 years ago

Hi there,

if I add an onDrag property the and object it is automatically dragged around when I start dragging. How do I prevent this behavior? I want to implement my own dragging function that does something different as I don't need to drag objects around.

I want to show different panorama images, but I don't want the gyroscope to control the view of the user. Therefore I added an ARScene with a Sphere and Image Material, if there is another solution for this, then let me know.

Thank you in advance!

dthian commented 6 years ago

Hi @dominicrico,

Quick question - is this for AR or VR?

"I want to implement my own dragging function that does something different as I don't need to drag objects around."

"I want to show different panorama images, but I don't want the gyroscope to control the view of the user."

dominicrico commented 6 years ago

Hey @dthian,

this is more like an Panorama Image/Video player/viewer than real AR/VR application. FYI: I use the react lib for my project.

I tried adding an Android Gesture Recognizer but it doens't work if there is an Viro component. I don't know what I'm doing wrong there, without a Viro component the Recognizer works as expected.

Is there an ViroViewScene equivalent for the react lib?

Thanks for your help!

dthian commented 6 years ago

Hey @dominicrico,

Apologies, I was thinking of ViroCore upon mentioning ViroViewScene - we should have a react lib equivalent in the next release of ViroReact, of which is coming up very, very soon (most likely this week) :) I'll update this thread once the update is out. Ideally, using the ViroReact's ViroViewScene should solve the problems you are experiencing above, with your own Gesture Recognizers.

dominicrico commented 6 years ago

Hey @dthian,

can't wait for the update ;) Thanks again!

dthian commented 6 years ago

Hey @dominicrico, we've actually just released ViroReact 2.5.1 ! This should contain the Viro3DSceneNavigator (a ViroViewScene counterpart) that you'll need as mentioned above.

Do let us know if you have any issues or questions.

dominicrico commented 6 years ago

Hey @dthian, awesome! Thank you for the info and help!

luyx2412 commented 5 years ago

It's still same issue with onDrag event automatically dragging object, How can resolve this problem? Thanks

dthian commented 5 years ago

Hey @luyx2412, one thing you can try is using onTouchDown, Move, and Up events to simulate drag events on your own through the ViroController.