Body Properties

Friction

Controls the surface friction coefficient used by body contacts.

Friction resists tangential relative motion at contact points. It is a body material property and is available on Dynamic, Static, and Kinematic bodies.

High-Level API#

GML
body.set_friction(value)
body.get_friction()

Range and default#

PropertyValue
Default0.2 (Jolt 5.6.0 default used by this wrapper)
Valid rangeAny finite value >= 0
Upper limitNo wrapper maximum
Creation fieldoptions.friction

A value of 0 removes friction from this body's material contribution. Larger values create stronger tangential resistance. The final response at a contact also depends on the other body and the physics engine's contact combination behaviour.

Example#

GML
var ice = jolt_box_create_dynamic(-2, 0, 3, 1, 1, 1, {friction: 0.05});
var rubber = jolt_box_create_dynamic(2, 0, 3, 1, 1, 1, {friction: 1.0});

rubber.set_friction(1.25);
var current = rubber.get_friction();

Low-Level / Advanced API#

Setters return true on success and false on invalid input, an invalid or stale body, or an unsupported motion type. Getters return the requested value or undefined when the operation fails. Inspect jolt_get_error() for the high-level error.