Creating fixtures or using an object for solid static blocks?

Discussion in 'Programming' started by Ant, Sep 13, 2019.

  1. Ant

    Ant Member

    Sep 13, 2019
    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...
    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);
    ...oppose to just creating a block and setting the density to 0. It works just the same when I stretch the object and whatnot.

  2. Bart

    Bart Member

    Jun 21, 2016
    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.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice