ARCore collider on generated planes

▼魔方 西西 提交于 2019-11-29 07:35:37

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

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.

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

I hope that helps!

Assuming you are doing this in Unity, you may want to use a Mesh Collider on the surface instead of a Box Collider.

I'm not sure about ARCore in Unity specifically, but in other AR frameworks it works something like in the attached screen shot, so I imagine it would be similar.

Adding a rigid body to the object causes gravity to be applied set gravity to 0 on the object rigid bidy. That will stop it falling away

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!