Ammo setDamping cannot prevent rotation of impostor

Could you please view the Playground: https://www.babylonjs-playground.com/#3EDS3A#477

We can switch between using Cannon and Ammo by toggling

const isUseAmmo = false;

When using Cannon, observe how the blue capsule does not tip over. This is because of the line:

compoundBody.physicsImpostor.physicsBody.angularDamping = 1;

I hope to recreate this same behavior using Ammo. When setting isUseAmmo = true and using the Ammo equivalent

compoundBody.physicsImpostor.physicsBody.setDamping(0, 1);

, the blue capsule tips over :cry:

Would anyone know how to have the capsule not tip over when using Ammo? Thank you!

Additional Information:
When using Ammo, this tipping behavior occurs for both Compound capsules (2 spheres + 1 cylinder) and single CapsuleImpostors: https://www.babylonjs-playground.com/#3EDS3A#481

Ooh it seems we have to use setAngularFactor instead of setDamping: https://www.babylonjs-playground.com/#3EDS3A#484

compoundBody.physicsImpostor.physicsBody.setAngularFactor(X);

where X can be nothing or anything (string, number, Vector3), which is a bit weird

Seems like Bullet’s setAngularFactor is a bit buggy: Rev 2.73 setAngularFactor() ignored? - Real-Time Physics Simulation Forum

It seems setDamping can set a finite angular resistance, but cannot completely prevent rotation, which setAngularFactor can

1 Like