[SOLVED] Parts of mesh not colliding

I’m using a terrain mesh (PlayCanvas | HTML5 Game Engine) for collision but a couple of sections aren’t working and the cube falls through.

The mesh looks fine but when an entity encounters the dodgy parts it drops through.

I isolated the polygons to confirm they’re at fault (when turned upside an entity collides with them).

I’ve tried editing the original mesh (replacing the sections and inverting their normals) but the problem persists and I’m plum out of ideas.

Any ideas why this is happening and how to fix it?

FWIW it seems to work fine in Unity :unamused:

(As a workaround I can add additional boxes to “plug the holes”, but this is time consuming, fiddly and doesn’t look very good).

Help!
TIA


Here, she’s trapped!

So although we discussed this on Twitter, I’ll post here just to provide a conclusion…

Bullet (the underlying physics engine used by PlayCanvas) has problems colliding:

  • Primitive shapes against long thin triangles.
  • Small primitive shapes (particularly fast moving ones) against comparatively large collision mesh triangles.

Really, I should put this information on the physics page in the User Manual because it is kinda useful.

One solution I’ve found that works pretty well is to subdivide the collision mesh until the problem goes away. Modelling apps like Blender, Max and Maya all have this function. For example, here’s the process in Maya:

I’ll be blogging about this, too.

In the end, I used Blender to subdivide the mesh (I could do it manually in Clara.io, but that’s not a practical solution).

The only issue was the resulting mesh was scaled x 10, translated and some areas appeared too dark. I’m sure playing around I could get a better result, but for now it’s usable as a collider in PlayCanvas after a few dirty fixes with scaling, etc.

1 Like