Hossein
Hossein

Reputation: 973

Virtual button in ARToolkit

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?

Upvotes: 2

Views: 957

Answers (1)

shalafi
shalafi

Reputation: 3996

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.

Upvotes: 3

Related Questions