physics_set_friction

When you bind a fixture to an instance using physics_set_friction this returns an "id" for the bound fixture. You can use this id to set the friction value of the bound fixture, not the "base" fixture, at any time using this function. Note that the friction is usually set to a value between 0 and 1, but you can use any non-negative value if required.

NOTE To make the physics engine use the new value in all cases, you'll need to deactivate and reactivate the physics instance using phy_active. See Updating Existing Contacts.

 

Syntax:

physics_set_friction(fixture, friction)

ArgumentTypeDescription
fixturePhysics Fixture IDthe id of the bound fixture
frictionRealthe new friction value to apply

 

Returns:

N/A

 

Example:

var fric = physics_get_friction(fix_id);
physics_set_friction(fix_id, fric + 0.1);

The code above gets the current friction value for the bound physics properties of the instance and then sets them to a different value.