Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting if an tap event with ARCore hits an already added 3d object

I am following the ARCore sample (https://github.com/google-ar/arcore-android-sdk) and I am trying to remove object 3d (andy) already added. How can I detect if an tap event with ARCore hits an already added 3d object?

like image 491
Vinicius Sossella Avatar asked Oct 13 '17 10:10

Vinicius Sossella


1 Answers

Using a listener is quite common approach in such situation:

private Node getModel() {
    Node node = new Node();
    node.setRenderable(modelRenderable);
    Context cont = this;
    node.setOnTapListener((v, event) -> {
        Toast.makeText(
            cont, "Model was touched", Toast.LENGTH_LONG)   // Toast Notification 
            .show();
    });
    return node;
}
like image 187
Andy Jazz Avatar answered Oct 02 '22 12:10

Andy Jazz