Bodies
JoltBody.set_friction
Sets the surface friction of an existing body.
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#
body.set_friction(value);| Argument | Type | Description |
|---|---|---|
| value | Real | Finite dimensionless friction coefficient ≥ 0. Values above 1 are allowed. |
Returns#
Boolean. true on success; false on invalid input, an invalid body or a native call failure. Read jolt_get_error() immediately.
Example#
Prerequisite: body holds a valid body in the running default world.
// body is a live JoltBody in the running default world.
if (!body.set_friction(0.8)) {
var error = jolt_get_error();
show_debug_message(error.message);
}The example sets friction to 0.8 and reports a failed operation.