I have a 3d object from android KudanAR library that seems to be implemented using OpenGL. Currently, I want to check which 3Dobject is clicked. Therefore, I need to know whether the screen coordinate (x,y) has touched the 3d objects. how do you implement it?
Asked
Active
Viewed 74 times
1
-
the 3d object class is this one https://wiki.kudan.eu/apidocs/AndroidDocs/dc/d43/class_a_r_node.html – Robert Limanto Jun 21 '17 at 06:41
1 Answers
0
Since OpenGL is rendering API there is nothing usefull in there for you. But there is common approach called raycasting. Idea is simple: cast a ray from camera and check which object it intersects. Here is a good tutorial for this approach.
I am nor familiar with kudan, maybe something usefull could be found there, at least bounding boxes and transformation matrix.
Another approach based on rendering objects with unique colors, picking value from frame buffer allow you to find which object is under cursor.

Jeka
- 1,364
- 17
- 33