I want a fast way to calculate the concave hull of a rigidbody. By that i mean take all of its colliders (which individually are convex) and compute the concave shape that they form together.
My only idea currently is to take a primitive sphere mesh using GameObject.CreatePrimitive that encompasses the object, and ray casting from each vertex inwards, then moving the vertex to that point (transforming it to local space).
This of course seems very expensive, and potentially not very accurate, not to mention that some of the ray casts may miss. I have tried casting 10s of thousands of rays with raycast commands using the jobs system and its suprisingly quick for the sheer number of them, and given I will likely only ever run this in the editor, I can tolerate it being a bit slow, but I cant help but feel theres a better solution.
EDIT: If possible, I would to have a perfect representation of the concave hull in a Mesh object (sphere and capsule colliders would of course need to be approximated, but convex meshs and box colliders wouldnt need to be).
Also, if possible I would like to be able to get the concave hull from the actuall mesh renderers. I dont even know where to begin for that.