Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect click on an object in OpenGL ES in Android application?

In my Android application, I have a bunch of meshes in a collection that are moving around in 3D space. I want something to happen to the mesh when any one of the moving mesh (objects) are touched. How can I detect which object has been tapped / clicked?

like image 528
ace Avatar asked Feb 14 '11 19:02

ace


2 Answers

In your View, you will need to override onTouchEvent() and determine if the touch event occurred on one of your objects. The Android Dev Blog has some examples on handling touch events.

like image 149
Robby Pond Avatar answered Oct 27 '22 04:10

Robby Pond


Ray picking.

like image 39
genpfault Avatar answered Oct 27 '22 03:10

genpfault