Is there a way to get MeshCollider convex hull mesh information?

Hi,
I was wondering, if there is a way to get the convex MeshCollider information in C# to e.g. generate a new mesh out of it. I played around with a very simple sample, but I can’t extract the convex information from the MeshCollider. I tried to use the sharedMesh property, but I end up with the original mesh (blue) and not the convex hull (green outline). Anybody knows if this is even possible?

br,
Max

I’ve done my share of digging and I came up empty. But chiming in, with the hopes that some one managed to achieve this!

I get the impression that nothing about the convex hull being generated is accessible because Unity uses PhysX or some other library, which may not allow this in their license.

It’s kind of frustrating when you’re looking right at the mesh, but can’t access or extract it.

There are quite a few Convex Hull implementations for Unity on GitHub under the MIT license that you could use instead. Not ideal, but if the need is pressing, that’s a viable solution.

Thank you for your reply. I ended up using this library - https://github.com/OskarSigvardsson/unity-quickhull/tree/master as this provided the easiest incorporation into my project.Hope this will help you too :slight_smile:

But there is actually no way to get it directly from the MeshCollider. I think it’s unlikely that this feature will be added, as this is such an edge case Oo

br,
Max

1 Like

For further reseach, anyone can check out this library too, which has even more examples for Computational Geometry in Unity - https://github.com/Habrador/Computational-geometry

1 Like