In WebGL build, Rigidbody only collides with Mesh Collider if it has previously collided with Box Collider

I have an issue where my collisions are ignored in the WebGL build, even though they work in the editor.

Here’s what’s happening:
Example 1: GIF by alicefromairconsole | Gfycat
Example 2: GIF by alicefromairconsole | Gfycat

The tank GameObject is a Rigidbody with Capsule Colliders.
The orange “floor” is a Mesh Collider, that white thing is a Box Collider.

If the Rigidbody ‘touches’ a Mesh Collider for the first time, it falls through, there is no collision.
If the Rigidbody first collides with a box collider however, the collision works, and after that it also collides as it should with Mesh Colliders.

In the Unity Editor, all collisions work as they should.

The issue is the same with both Convex and non-Convex Mesh Colliders.

My workaround for the moment is just to place an extra box collider for the Rigidbody to collide with “first”, but that can’t be the best solution to this. Any ideas?

Edit: I tested some more, and this also happens in an entirely empty project with just one Mesh Collider and a Rigidbody (Sphere) in it.
Even more strangely, the angle of the Mesh Collider makes a difference: As soon as the mesh collider is rotated a little, the collision works as it should.

Example 3: GIF by alicefromairconsole | Gfycat
Example 4:
(only mesh rotation changed between these two).

In my own project, the collision also works when I rotate the “floor” mesh slightly.
Is this a bug or is there something I’m missing here?

Edit 2:
Link to build: Unity WebGL Player | New Unity Project
Link to project folder:

It seems to be an issue specific to meshes made in Blender.

Edit 3:
Another test build: Unity WebGL Player | New Unity Project
Happens both with .blend files as well as blender fbx exports, but not with Wings3D, for example.

Edit 4: The issue does not happen with an obj file exported from blender, so the problem is somewhere either in the Blender export or the Unity import…

I took a look at your project and can repro this.

Can you be so nice to make a bug report from the linked project to also include the last scene you linked here with all the export options and the original blend file?

Update from our end:

  1. This is a precision issue that we can’t easily fix for WebGL/JS. Sorry.

  2. You can workaround this by changing the Fixed Timestep physics settings.

Hello. I have same problem.
Standalone and Editor work, but webgl no.
Standalone build:
WebGL build:

mesh colliders is not stabil on webgl builds!
valve fix pls! oops not valve unity fix pls!

so whats happening at the end im still have this isue of mesh collider in webgl i need the mesh collider works on webgl why this is not happening ? what precision stuff man come one i have to build my game for all plataforms but since this issue now im stuck and i cant move foward now with out change all my game just for this? seriously?

Man this bug is still here?
My first WebGL build and nice surprise: HALF of my spheres go through the terrain… what the hell… please do things RIGHT or don’t do them.

The trick with the “Hit a Box Collider first” really works @N-Dream-AG . :slight_smile:

I must have gone through a hundred posts about this issue before I came to this post with your random researched solution of the problem.

The workaround “collide with box collider first” just saved my project. Huge thanks, @N-Dream-AG! I wonder how the root cause can be a precision problem.

I have to add: how this issue is handled or better not handled is deeply disappointing. It’s been around for 4 years?!

I spent 6 hours tyring to figure out why my boundary box wont keep my damn player on the screen. Ive also tried to make a pinball game before, ive tried networking.


Yup collider’s just don’t work.