viromedia / virocore

ViroCore cross-platform AR/VR renderer
MIT License
370 stars 108 forks source link

Android 2D UI vs. ViroCore ARScene #293

Closed marcspraragen closed 5 years ago

marcspraragen commented 5 years ago

Environment

  1. Windows
  2. ViroCore 1.14
  3. Samsung 8+

Disclaimer: I'm new to using Android Studio layouts as well as ViroCore scene hierarchies

Description

I modified HelloWorldAR to add a new Android UI button (disabled at start) to choose the animations of a 3D model in AR. I've tried adding the button from XML as well as in codel.

In any case, my problem is that the scene and the button seem to be in conflict over events-- the scene controller or its plane trackers' event listeners are consuming what would be the button's onclick event.

When controller tracker is turned off (in code, once the model is placed on an anchor node), clicking the button launches the animations correctly, but the lack of plane trackers lets the animated model slide all over the place. I've attached the source code files for this case (with .txt extensions so they'd upload :)

Any ideas? A more general question is: how best to integrate (and prioritize) listeners when using ViroCore scenes + Android Studio layouts?

Reproducible Demo

Relevant comments in files are labeled with VIROCORE:. I disabled the controller at line 177 of ViroActivity.java . Placeholders for animated test models also labeled with VIROCORE

build.gradle.txt

viro_view_hud.xml.txt

ViroActivity.java.txt

marcspraragen commented 5 years ago

Solved: button.getParent().requestDisallowInterceptTouchEvent(true);