Bodies

JoltBody.get_friction

Returns the body's current friction coefficient.

Call this method on a live JoltBody. Friction acts through contacts on Dynamic, Static and Kinematic bodies. It is separate from linear or angular damping.

Syntax#

Syntax
body.get_friction();

Returns#

Real | undefined. The current friction coefficient, or undefined on an invalid body or a failed operation. Zero is valid friction, not an error; read jolt_get_error() on failure.

Example#

Prerequisite: body holds a valid body in the running default world.

GML
// body is a live JoltBody in the running default world.
var friction = body.get_friction();
if (is_undefined(friction)) {
    var error = jolt_get_error();
    show_debug_message(error.message);
}
else {
    show_debug_message(friction);
}

The example distinguishes a valid numeric value from undefined before displaying the result.