CannonJS SphereImpostor keeps sliding even with high friction

Hi all!

Is there a way to stop a SphereImpostor from sliding on a flat plane?

Please find a link to the Playground here:

Please click inside the Playground scene to activate pointer lock.
WASD: Move

Replacing SphereImpostor with BoxImpostor can stop the bottom mesh from sliding, even with friction: 0 for both the bottom mesh and ground mesh.

bottom.physicsImpostor = new BABYLON.PhysicsImpostor(bottom,
    BABYLON.PhysicsImpostor.SphereImpostor, {
        mass: 1,
        restitution: 0,
        friction: 9999999999
    }, scene);

The goal is to have this bottom sphere serve as the bottom portion of a capsule for player physics

Thank you for your help :smiley:

A simpler example for your reference :slight_smile: :

This is a modified version of @RaananW’s Capsule Playground in Capsule Impostor with Cannon and Babylon - Questions & Answers - HTML5 Game Devs Forum

Added bottom.physicsImpostor.physicsBody.angularDamping = 1, which reduces a lot of sliding. However, there is still a little bit of sliding while on the red slide.

Reference: physicsBody: angularDamping/linearDamping question

To achieve the physically impossible, you will have to go to the weird realm of sleeping objects! :slight_smile:

When the two collide, put the sphere to sleep. You can call wakeUp whenever you want to keep it going.

Not sure about your usecase, but that would be the way to go for me. Either that or constantly setting liner velocity to 0,0,0 on each frame.


Thank you so much for your awesome suggestions, @RaananW :smiley:

1 Like