You can map it onto the 3D world. You just have to do some math. Get the x and y coordinates of your touch-event. Then you have to do this for both z=0 (near plane) and z=1 (far plane):
Translate the line (x,y,0) --> (x,y,1) in screen-coordinates into your 3D coordinates (hint: use gluUnProject()). Then you have line (x1,y1,z1) --> (x2,y2,z2) in 3D coordinates. This is all relatively simple using gluUnProject(). Now the hard part: Calculate the nearest point where your line (x1,y1,z1) --> (x2,y2,z2) is intersecting with one of your objects. This code you have to do all by yourself. Brush up on your geometry math :-). On May 14, 1:03 pm, Gerald <[email protected]> wrote: > Hi, > I need to use GLSurfaceView to render some objects, and move or select > the objects by finger touch. > By overriding the onTouchEvent, I can receive incomming motion events. > The motion event contains x and y position in the view, but can't map > to open GL 3D world. > Is there any way to know which object should be selected from received > motion event? > Thank you > > Gerald --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

