|fixture||the fixture that is to be deleted from memory|
Since once a fixture has been bound to an instance that instance
maintains the fixtures properties, we can remove the fixture from
memory with this function, particularly if we no longer plan to use
it again. Please note that failure to remove fixtures after they
are no longer needed may cause a memory leak which will slow down
and eventually crash your game, so you should take care to clean up
properly after defining and binding fixtures.
var fix, inst;
fix = physics_fixture_create();
inst = instance_create_layer(x, y, "Instances", genericBodyObject);
The code above will create a fixture and assign its index to the variable "fix". It then defines the shape and density of the fixture before binding it to the instance that was created with the index stored in the variable "inst". Finally, the fixture is deleted to prevent memory leaks as it is no longer needed.