我已经在 opengl 中为我的应用程序创建了一个3D物体。该物体类似于人体,可以通过触摸旋转。如何检测触摸在这个3D物体上的位置。也就是说,如果用户触摸头部,我必须检测到它是头部。如果触摸在手上,则必须被识别。即使物体旋转到其他方向,它也应该起作用。我认为需要获取触摸在3D物体上的坐标。
这是我获取视图上触摸位置的方法。
这是我获取视图上触摸位置的方法。
- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
{
UITouch* touch = [touches anyObject];
CGPoint location = [touch locationInView: self];
m_applicationEngine->OnFingerDown(ivec2(location.x, location.y));
}
有人可以帮忙吗?提前感谢!