Static physics objects still moving (AmmoJS)

If you move a physics object before creating it’s impostor when it’s static, the physics object will move toward that direction at 0.01 world unit per hour. This must be because it has a tiny tiny tiny bit of linear velocity still imparted on the static object. Consider the reproduction here, look at the variables at the top.

BTW once you tell it to speed up yhe simulation, you’re computer might lag a bit. Look in your dev console to see the Y position of the ground printed out.

https://playground.babylonjs.com/#66PS52#107

Also, I only started to notice that because I would be playing DND for 3 hours in Playtable and our figures would be sinking into the ground slowly over the course of our session. this is also posted here so others may find this bug and know what the workaround is.

pinging @Cedric

I’m taking a look.

@jason.spafford
I don’t know yet why it happens exactly. It has to do with the way bjs update the physics body from the mesh transform.
Until I find a valid fix, you can disable the bi-directional link for static meshes like in this PG:

https://playground.babylonjs.com/#66PS52#111

Check line 36

1 Like

Y’all are absolutely killing it, as usual.

Not because of any commitment to find and fix bugs, but because you guys are consistently responsive, and on the ball. I wish I could give back some more. I’ll have to post here and try to help other users.

1 Like

PR Float comparison using != instead of epsilon difference by CedricGuillemet · Pull Request #9157 · BabylonJS/Babylon.js · GitHub

2 Likes