Mesh Collider Broken

So I came across this issue today where the mesh collider wasn’t working and no amount of changes to my settings would fix it.

Luckily, simply deleting the mesh asset and reimporting it fixed it and it is working stellar once again!

But it makes me to wonder… if this mesh collider is broken, are there any others that might be broken as well? Is this a known issue at PlayCanvas?

Hi @CaseyDeCoder,

That’s interesting, I can’t reproduce this. If it’s the same asset being used it wouldn’t normally matter if you reimport it or not. The mesh collider is being generated on runtime, not on import time.

Are you able to reproduce this on a sample project? It would be good to know if there is an issue to log on the engine repo.

‘Unfortunately’ I’m not able to reproduce this now, but it has happened to me once before, hence why I was compelled to make this post.
If it happens to me again, I’ll be sure to make efforts to isolate the problem.


Finally found the issue!
Mesh Collider Not Working

When using differently scaled mesh colliders of the same mesh, only 1 instance of the collider will be used.

When I originally stated that reimporting the mesh fixes the issue, I had only added the mesh back to my stairs but had forgotten they were used on some decoration as well. After reapplying it, the issue came back and with some experimentation I found this to be the issue.

For us personally I don’t think it will be such a big deal, but I’d still like to make an issue for this. Should I do that on the PlayCanvas or the Ammo github?


PlayCanvas repo please :slight_smile:

Something for @will I believe to potentially look at

Placing a mesh into the physics world is a computationally expensive operation - the engine generates an Ammo compound shape from a number of bvh triangle meshes, one for each mesh instance. Once generated the trimeshes then get cached for future re-use. As a result, when you use the same mesh for another collider, the trimeshes are taken from the cache, instead of generating new ones. Please, add an issue to the engine repo:

For the moment you could patch the following engine method to avoid grabbing a mesh from the cache (or implement your own logic for when to do that):

// do this before any of your level entities are initialized = function (entity, data) {
   // patched method