gpt4 book ai didi

arcore - ARCore 中的 3D 对象点击事件

转载 作者:行者123 更新时间:2023-12-05 06:35:03 26 4
gpt4 key购买 nike

如何在android studio中获取使用arcore SDK渲染的3D物体的点击事件?我的要求是单击该 3D 对象并显示弹出对话框。

最佳答案

这与 ARCore 无关。您使用的游戏引擎/框架实际上对此负责。

例如,如果您使用的是 Unity,则可以使用 Raycasting。

RaycastHit hit;
Ray ray = yourARCamera.ScreenPointToRay(Input.GetTouch(0).position);
if (Physics.Raycast(ray, out hit))
{
// Check if what is hit is the desired object
if(hit.tag == "The_Tag_Of_The_Object_You_Are_Looking_For")
{
// User clicked the object.. Do something here..
}
}

在这里阅读更多:

https://unity3d.com/learn/tutorials/topics/physics/raycasting https://docs.unity3d.com/ScriptReference/Physics.Raycast.html

关于arcore - ARCore 中的 3D 对象点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49855853/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com