• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Creating fixtures or using an object for solid static blocks?

A

Ant

Guest
There is probably a really simple answer to this but I recently looked through the physics tutorial on the blog and was wondering what the benefit of having this in the create event of a static floor object is...
Code:
var fixture = physics_fixture_create();
physics_fixture_set_box_shape(fixture, sprite_width / 2, sprite_height / 2);
physics_fixture_set_density(fixture, 0);
physics_fixture_set_restitution(fixture, 0.1);
physics_fixture_set_friction(fixture, 0.2);
physics_fixture_bind(fixture, id);
physics_fixture_delete(fixture);
...oppose to just creating a block and setting the density to 0. It works just the same when I stretch the object and whatnot.

Thanks
 

Bart

WiseBart
One advantage of assigning a fixture this way is that you get its id, since there is no way to get the id of the default fixture that you define in the object's physics properties.
Otherwise there doesn't seem to be much of a difference.
 
Top