ARCore collider on generated planes

孤街醉人 提交于 2019-11-28 01:15:03

问题


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?


回答1:


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!




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/45962848/arcore-collider-on-generated-planes

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