Physics Engines and Hinge Joint weirdness

#1

Hey Gang,

I’m seeing some inconsistent behavior when using hinge joints with different physics engines.

In the following playground, cannon.js is enabled and if you press ‘a’ in the scene you can drop spheres onto a mechanical toggle. This seems to work fine in cannon.js, however if you try doing the same thing in ammo.js, playground here…it seems like something is changing the physics imposter to a triangular primitive, even though the “rocker” object is set to use a mesh imposter.

It seems strange to me that ammo.js would seemingly somehow change the physics imposter?

What am I missing?

I’d like to figure out how to replicate the same behavior in ammo.js as we see in cannon.js…mainly due to the limitations in mesh imposters with cannon.

Thanks a million for the help.

0 Likes

#2

pinging @trevordev :smiley:

0 Likes

#3

So I think the issue is stemming from AmmoJS’s mesh impostor in babylon is actually mapped to Ammo’s convex hull type and sadly your shape is concave :sob:. It seems others using Bullet (original c++ version of ammo) have hit similar issues bulletphysics - bullet physics : concave moving shape - Stack Overflow. To workaround the issue you could try to make a compound shape out of convex shapes as described in the authoring section of Use a Physics Engine - Babylon.js Documentation but Ill keep looking to see if I can find an automatic solution.

0 Likes