How to prevent some weird bumps for models while physics enabled?

Sorry for that I can’t reproduce it in a single example. The problem happens with physics settings like this:

window.CANNON = CANNON;
scene.enablePhysics(null, new CannonJSPlugin());
ground.physicsImpostor = new PhysicsImpostor(ground, PhysicsImpostor.BoxImpostor, { mass: 0, friction: 0.0, restitution: 0.7 }, scene);
player.physicsImpostor = new PhysicsImpostor(hero, PhysicsImpostor.CylinderImpostor, { mass: 2, friction: 0.0, restitution: 0.3 }, scene);

In a scene enabled physics and gravity, with a simple flat ground and a mesh of player. Sometimes the player’s mesh would suddenly got bumped by mysterious power, the mesh may fall down or just rotate slowly. How to prevent it?
And by the way, how can I lock the rotation of a mesh to prevent it changes from physic influences?

cc @Cedric but honstly it is hard to know without a repro. If it is a scene with only a flat ground and a sphere, why not creating a repro in the playground ?

You can try to use a fixed timestep. Sometimes, with high delta time values, penetration can change between 2 frames giving a little jump.

2 Likes