如何在 Android 中使 3D OpenGL 对象的每个组件都可触摸?

如何在 Android 中使 3D OpenGL 对象的每个组件都可触摸?

问题描述:

假设我有一个在 Android 中使用 GLSurfaceView 显示的 3d 汽车模型.该模型由许多组件组成,是否可以控制每个组件或使每个组件单独响应触摸事件?例如,如果我想选择一个滚轮,我需要做的是触摸滚轮.

let's say I have a 3d car model displayed using GLSurfaceView in Android. This model consists of many components, is that possible to control each of them or make each of them response to touch events individually? for example, if I want to select one wheel, what I need to do is touch the wheel.

我认为您正在寻找光线拾取或光线交叉.

I think you are looking for ray picking or ray intersection.

此答案包含指向 iOS 示例/视频的链接,我相信这正是您所追求的.https://gamedev.stackexchange.com/questions/12360/how-do-you-determine-which-object-surface-the-users-pointing-at-with-lwjgl/12367#12367

This answer has a link to a iOS sample/video which I believe is what you are after. https://gamedev.stackexchange.com/questions/12360/how-do-you-determine-which-object-surface-the-users-pointing-at-with-lwjgl/12367#12367

另一个相关的SO问题:实现光线拾取

Another related SO question: Implementing Ray Picking

这应该会让你开始做你需要做的事情.

That should get you started on what you need to do.