EddyVerbruggen / nativescript-ar

Augmented Reality NativeScript plugin
https://www.nativescript.org/blog/preview-of-augmented-reality-in-nativescript
MIT License
118 stars 36 forks source link

Gesture Event Propagation #69

Closed nickolanack closed 4 years ago

nickolanack commented 4 years ago

@EddyVerbruggen I would like gesture events to propagate up the scene hierarchy until they reach a node that handles the gesture. Let me know if you see any issues with that? And I'll implement it.

I think the solar system example will benefit from this since atmosphere objects (ie: earth clouds sphere) could potentially block tap events set for the root object (planet)

EddyVerbruggen commented 4 years ago

Hey Nick, indeed those clouds block the event and I’d rather have those events propagate as well!

Btw I played with your iOS scale PR and it works perfectly well, really cool! I tried fixing my own crappy pan (drag) iOS implementation as well but didn’t succeed yet. If the model you’re dragging is perfectly rotated it works well, but if it’s rotated 180 degrees on the y-axis dragging it left moves it right. Perhaps this rings a bell?

nickolanack commented 4 years ago

Ok Great.!

Oh yes I noticed that panning behaviour as well: I believe the issue is because to x/y deltas are relative to the cameras local orientation, and should be translated into world deltas and then applied to the models world position. does that help?

I'll play around with it

EddyVerbruggen commented 4 years ago

I tried a little but couldn't make it work to a level where it was better than what I had.

I think the Android behavior is a bit better anyway because in case the model was anchored to a plane its Y-axis doesn't change so you can move a node over a surface.

The best way to see the difference I think is by running the new demo I just added (#70): it's the "Try before you buy" menu option in the Pokemon demo app (npm run demo.pokemon.ios).

nickolanack commented 4 years ago

cool I'll take a look

nickolanack commented 4 years ago

The only thing I’m not totally sure about, is if pinch drag rotate gestures will propagate in android