- Home /
Compute mesh inertia tensor failed - NOT the usual problem
Hi Guys.
I'm implementing a destructible terrain system.
For this, I need to change the collision mesh whenever it gets damaged. Since I'm changing it frequently, the object needs a kinematic rigidbody to prevent unity from trying to optimize it as static collision geometry. This works fine, however the performance degrades rapidly as the terrain size increases.
To fix the performance, I split it into a grid of separate meshes, all as children of the main object with the rigidbody on it. Now, when I generate and assign the meshes to those children, it throws the "Compute mesh inertia tensor failed" error, but only on some of them.
I think the reason it only throws the error on some of them is because of floating point error in their alignments, causing their verts to not line up. However, the algorithm I'm using to generate the meshes doesn't have any simple way for me to modify it so that these verts are lined up perfectly.
The error also tells me to supply an inertia tensor manually, but that doesn't stop the error. If I assign a tensor, assign the mesh, then assign a tensor again, the error still gets thrown instantly when I assign the mesh.
How can I assign an inertia tensor in a way that actually stops this error?
Shouldn't a kinematic rigidbody not be trying to compute an inertia tensor anyway?
Is there any way other than a rigidbody to mark a collider as dynamic?