Question about physics and Ammo

Hi everyone,
I have been playing with Babylon and Ammo and I can’t seem to get it right…
The desk (with elliptic hole in it) is flickering when the dice drops on it (and if i leave it on the screen for like half an hour, it actually moves away from the center), dice is properly colliding with the desk when it falls in the hole, but other colliders does not work (it does not bounce of the walls of the elliptic shape - i have colliders there to simulate the shape according to manual from Babylon docs and playground

You can see what i did on (press left mouse button roll the dice):

(as I am not able to post more then 2 links, to above url just add the below filenames)
The desk is loaded from:

blender file:

The dice is:
or blender file:

(the files I provided above are just relocated and renamed from the ones used in the code itself for easier sharing - don’t let it confuse you :slight_smile: )

What am I doing wrong?
Thank You, Ivan

Adding @cedric our resident expert for ammo

Let me check that …

Haven’t mentioned in the question, but I have never ever made any 3d model before so if this seems stupid what I did with model (desk with hole is mine, dice is obviously someone else work lol), I am sorry :slight_smile:

If the desk doesn’t need to move then you can set the mass to 0. It will be static and collision will be more accurate. Also, you can merge the desk as 1 single mesh and set the impostor to BABYLON.PhysicsImpostor.MeshImpostor

Like in this PG:

The Mesh Impostor | Babylon.js Playground

More documentation here : Advanced Physics Features | Babylon.js Documentation

Hi, thx for the help, very much appreciate it :slight_smile:
Tho, I still don’t get it… This is what I have done in contrast of what I did before:

  • deleted all colliders i had
  • converted the Cube object with modifier to single mesh (clicked on Convert to mesh which removed modifier)
  • deleted cylinder as I don’t have any use for it anymore
  • exported that to .glb

In javascript, i changed the desk impostor from that with colliders to MeshImpostor

The result is that the cube (I have changed the dice to simple box (Babylon.MeshBuilder.CreateBox) to make sure that the behavior does not have anything to do with my programming of the dice impostors) is still falling through the desk, like the desk have no space occupied.

You can take a look of what I did at the same url as before.

Model I used you can download same as before with filenames:

Thanks for the effort to help guys :heart:


order of initialization is important.
I fixed it here:
roll dice | Babylon.js Playground

1 Like