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?
The plane manager is a type of trackable manager. The plane manager creates GameObjects for each detected plane in the environment. A plane is a flat surface represented by a pose, dimensions, and boundary points. The boundary points are convex.
ARCore provides two different SDKs for using Unity to develop AR apps for Android. AR Foundation with ARCore XR Plugin, and ARCore Extensions — Recommended for all new projects.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With