iphone - Detecting touch position on 3D objects in openGL -
i have created 3d object in opengl 1 of application. object human body , can rotated on touch. how can detect position of touch on 3d object. means if user touches head, have detect head. if touch on hand, has identified. should work if object rotated other direction. think coordinates of touch on 3d object required.
method getting position of touch on view.
- (void) touchesbegan: (nsset*) touches withevent: (uievent*) event { uitouch* touch = [touches anyobject]; cgpoint location = [touch locationinview: self]; m_applicationengine->onfingerdown(ivec2(location.x, location.y)); } can help? in advance!
forget raytracing , other top notch algorithms. have used simple trick 1 of our applications(iyan 3d) on app store. technique need 1 render pass everytime finish rotating scene new angle. render different objects (head, hand, leg etc) in different colors (not actual colors unique ones). read color in rendered image corresponding screen position. can find object based on color.
in method can use change rendered image resolution balance accuracy , performance.
Comments
Post a Comment