physics_set_density

This function sets the density value for a bound fixture.

Syntax:

physics_set_density(fixture, density)


Argument Description
fixture the id of the bound fixture
density the new density value to apply


Returns: N/A


Description

When you bind a fixture to an instance using physics_fixture_bind this returns an "id" for the bound fixture. You can use this id to set the density value of the bound fixture, not the "base" fixture, at any time using this function.


Example:

var density = physics_get_density(fix_id);
physics_set_density(fix_id, density - 0.1);

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


Back: Fixtures
Next: physics_set_restitution
© Copyright YoYo Games Ltd. 2018 All Rights Reserved