生成平面上的 ARCore 对撞机 [英] ARCore collider on generated planes

查看:34
本文介绍了生成平面上的 ARCore 对撞机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在玩 AR 核心,想让一个物体在房间里飞来飞去并能够着陆.我不确定如何根据房间的视觉效果向 ARcore 生成的平面添加对撞机.这会涉及以某种方式在平面上实例化盒子碰撞器吗?

I'm just playing around with AR core and want to have an object flying around the room and able to land. I'm unsure about how to add colliders to the planes that ARcore is generating based on the visuals on the room. Would this involve instantiating box colliders on the planes somehow?

推荐答案

ARCore SDK 的可跟踪平面本质上是可识别的平面,例如地面或桌面.

The ARCore SDK's trackable planes are essentially identified flat surfaces such as the ground or a tabletop.

您可以向 SDK 询问每个可跟踪平面的边界多边形(按顺时针顺序检索)的点列表,并通过三角剖分从这些点创建网格.网格准备好后,创建一个 GameObject 并添加一个引用它的 MeshCollider 组件.

You can ask the SDK for a list of points for each trackable plane's boundary polygon (retrieved in clockwise order) and create a mesh from those points via triangulation. With the mesh ready, create a GameObject and add a MeshCollider component that references it.

我已经创建了一个免费的 Unity 插件来实现这一点.随意使用它:https://github.com/jonas-johansson/ARCoreUtils.

I've created a free Unity plugin that does exactly this. Feel free to use it: https://github.com/jonas-johansson/ARCoreUtils.

希望能帮到你!

这篇关于生成平面上的 ARCore 对撞机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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