本文介绍了使用ARCore检测点击事件是否击中了已添加的3d对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在关注ARCore示例( https://github.com/google-ar/arcore-android-sdk ),而我正在尝试删除已添加的对象3d(Andy).如何检测带有ARCore的轻击事件是否击中了已经添加的3d对象?
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?
推荐答案
在这种情况下,使用listener
是很常见的方法:
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;
}
这篇关于使用ARCore检测点击事件是否击中了已添加的3d对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!