K
KriLL
Guest
Hi guys,
I have a bit of a problem and I was wondering if anyone know if this is the normal behavior.
I have a block that I define all the physics fixtures for it via code.
I then have a collision with another object which should then cause the block to change its physics fixtures.
To summarize the code
Is this correct?
Code below if that helps.
///Physics Fixtures defined
var blockfixture;
blockfixture= physics_fixture_create();
physics_fixture_set_box_shape(blockfixture, sprite_get_width(sprite_index) / 2, (sprite_get_height(sprite_index) / 2)-1);
physics_fixture_set_density(blockfixture, 20.0);
physics_fixture_set_restitution(blockfixture, 1);
physics_fixture_set_linear_damping(blockfixture, 1);
physics_fixture_set_angular_damping(blockfixture, 1);
physics_fixture_set_friction(blockfixture,50);
physics_fixture_set_awake(blockfixture, true);
my_fixture = physics_fixture_bind(blockfixture, id);
physics_fixture_delete(blockfixture);
Then when a collision occurs it runs the following:
///Remove fixture
physics_remove_fixture(id, my_fixture);
///Create new fixture
var changefixture;
changefixture= physics_fixture_create();
physics_fixture_set_box_shape(changefixture, sprite_get_width(sprite_index) / 2, (sprite_get_height(sprite_index) / 2)-1);
physics_fixture_set_density(changefixture, 5.0);
physics_fixture_set_restitution(changefixture, 0);
physics_fixture_set_linear_damping(changefixture, 0);
physics_fixture_set_angular_damping(changefixture, 0);
physics_fixture_set_friction(changefixture,0);
physics_fixture_set_awake(changefixture, true);
my_new_fixture = physics_fixture_bind(changefixture, id);
physics_fixture_delete(changefixture);
Thanks
I have a bit of a problem and I was wondering if anyone know if this is the normal behavior.
I have a block that I define all the physics fixtures for it via code.
I then have a collision with another object which should then cause the block to change its physics fixtures.
To summarize the code
- Define fixtures for block
- Collision occurs
- Delete current fixture
- Create new fixture and assign to block
Is this correct?
Code below if that helps.
///Physics Fixtures defined
var blockfixture;
blockfixture= physics_fixture_create();
physics_fixture_set_box_shape(blockfixture, sprite_get_width(sprite_index) / 2, (sprite_get_height(sprite_index) / 2)-1);
physics_fixture_set_density(blockfixture, 20.0);
physics_fixture_set_restitution(blockfixture, 1);
physics_fixture_set_linear_damping(blockfixture, 1);
physics_fixture_set_angular_damping(blockfixture, 1);
physics_fixture_set_friction(blockfixture,50);
physics_fixture_set_awake(blockfixture, true);
my_fixture = physics_fixture_bind(blockfixture, id);
physics_fixture_delete(blockfixture);
Then when a collision occurs it runs the following:
///Remove fixture
physics_remove_fixture(id, my_fixture);
///Create new fixture
var changefixture;
changefixture= physics_fixture_create();
physics_fixture_set_box_shape(changefixture, sprite_get_width(sprite_index) / 2, (sprite_get_height(sprite_index) / 2)-1);
physics_fixture_set_density(changefixture, 5.0);
physics_fixture_set_restitution(changefixture, 0);
physics_fixture_set_linear_damping(changefixture, 0);
physics_fixture_set_angular_damping(changefixture, 0);
physics_fixture_set_friction(changefixture,0);
physics_fixture_set_awake(changefixture, true);
my_new_fixture = physics_fixture_bind(changefixture, id);
physics_fixture_delete(changefixture);
Thanks
Last edited by a moderator: