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#
body.set_friction(value)
body.get_friction()Range and default#
| Property | Value |
|---|---|
| Default | 0.2 (Jolt 5.6.0 default used by this wrapper) |
| Valid range | Any finite value >= 0 |
| Upper limit | No wrapper maximum |
| Creation field | options.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#
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.