Hi there. I’m having an issue with changing a mesh and updating it’s mesh collider.
I can get it working but re-creating the mesh collider is incredible expensive. I’ve seen all sorts of suggested solutions for doing this, the only one that’s working here on 2019.4.x is-
meshCollider.SharedMesh=mymesh;
I’ve seen other posts that suggest turning the collider off and on, baking a mesh and swapping it, but as I say the only one I can get working here is the one above. And as I say it’s enormously expensive.
Is this where you’d employ the GPU to do the work? If so how? Anyone have any other suggestions?
Thanks.
I was recently reworking some code to add dynamic mesh colliders to one of my objects. I periodically call this, essentially on the colliders, and I can barely notice any performance impact at all, even with a fair number of these running at once:
PlatformRenderers[platformIndex].BakeMesh(_platformMeshes[platformIndex]);
_platformColliders[platformIndex].sharedMesh = null;
_platformColliders[platformIndex].sharedMesh = _platformMeshes[platformIndex];
How often are you updating the collider? And how complex is your mesh? I don’t think you can expect very good performance if you’re trying this on some high-poly models without thousands of verts.