Virtual button in ARToolkit

安稳与你 提交于 2019-12-11 01:18:59

问题


I want to develop an Android application to detect some target and show play icon over it. When user click the play icon, augmented reality played on another activity.

I use ARToolkit as a SDK. The Interaction example is the best match my requirements. But the problem is i cant make the play icon clickable and in that example, the whole view is clickable.

In brief, how can i get marker coordinates on Android view?


回答1:


The play button you want to place is a 3D object inside a GLSurfaceView, there is no "View" associated to that object, so you can't just use an OnClickListener.

ARToolkit gives you the marker coordinates on 3DSpace, but that I don't think that coordinates are what you are asking for.

As I see it, you have 2 main options:

  • You made a play button that appears in the screen (not overlaid on the marker) and then you use it as a normal View. You can link the visibility to the object to the event of the marker being found or not.
  • You process the touch event on the GLSurfaceView doing raycasting and checking if it hits the object that is the play button.

Option 1 is the simplest, option 2 is what you describe.



来源:https://stackoverflow.com/questions/37814345/virtual-button-in-artoolkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!