Difference Between Rolling and Sliding Friction in Ammo.js

In ammo.js—the JavaScript port of the Bullet physics engine—simulating realistic physical interactions requires a clear understanding of how different forces oppose motion. This article explains the practical and mathematical differences between standard sliding friction and rolling friction, detailing how they affect rigid body simulations and how to configure them in your projects.

Standard Sliding Friction

Standard sliding friction (often referred to simply as “friction” in ammo.js) resists the relative lateral motion of two solid surfaces in contact. When a rigid body slides across a flat plane, sliding friction applies a force at the contact point in the direction opposite to the sliding movement.

In ammo.js, you configure this using the setFriction method on a rigid body:

rigidBody.setFriction(0.5);

This value typically ranges from 0.0 (completely frictionless, like ice) to 1.0 or higher (very rough surfaces). Sliding friction is essential for preventing objects from sliding infinitely across surfaces when a force is applied.

Rolling Friction

Rolling friction resists the rotational motion of a round object—such as a sphere, cylinder, or wheel—as it rolls across a surface.

In a pure mathematical physics simulation, a perfect sphere contacting a perfectly flat ground has an infinitely small contact point. Because of this, standard sliding friction cannot generate enough torque to stop the sphere from rolling; without a counter-torque, a rolling ball in a physics engine would roll forever. Rolling friction solves this by applying an artificial torque that opposes the angular velocity of the rolling object.

In ammo.js, you configure this using the setRollingFriction method:

rigidBody.setRollingFriction(0.1);

Without setting a rolling friction value greater than zero, spherical objects in your ammo.js scene will never come to a stop on a flat surface, even if standard friction is set to a high value.

Key Differences Summary