如何在 Android 中使 3D OpenGL 对象的每个组件都可触摸? [英] How to make each component of a 3D OpenGL object touchable in Android?

查看:20
本文介绍了如何在 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.

这篇关于如何在 Android 中使 3D OpenGL 对象的每个组件都可触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆