1

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?

Robert Limanto
  • 2,068
  • 4
  • 17
  • 27

1 Answers1

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