2

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?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Hossein
  • 933
  • 2
  • 9
  • 21

1 Answers1

3

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.

shalafi
  • 3,926
  • 2
  • 23
  • 27
  • Thanks @shalafi for your answer. Do you have any snippet or sample code for option 2? – Hossein Jun 15 '16 at 14:55
  • if you want to do down that road I suggest you use some sort of 3D engine on top of ARToolkit, check out https://github.com/plattysoft/ArToolKitJpctBaseLib and you can check how to do raycasting using jPCT-AE, it will make your life easier. – shalafi Jun 15 '16 at 22:01