• 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!

physics_fixture_bind always returns 1

N

Nathan_HiberDive

Guest
No matter how many times I call physics_fixture_bind it always returns 1, when it should be a unique index to the bound fixture. Ultimately this seems to be the cause of "The instance does not have an associated physics representation" error when I try to change the density with physics_set_density

Here is the most basic code I have that generates the issue. Also of note, the room is a physics world and the obj_jointHandler does Use Physics and has a sprite.

On create in obj_rope:
Code:
global.jointsList[0] = instance_create(startingX,startingY,obj_jointHandler);
var mainFixture;
mainFixture = physics_fixture_create();
physics_fixture_set_circle_shape(mainFixture, 1);
physics_fixture_set_density(mainFixture,0.5);
global.jointsList[0].localFixture = physics_fixture_bind(mainFixture, global.jointsList[0]);
physics_fixture_delete(mainFixture);

On a step in obj_rope:
Code:
physics_set_density(global.jointsList[0].localFixture, 2)
 

Jezla

Member
Uncheck uses physics on your obj_jointHandler. If you're defining a fixture for the instance via code, you do not need to check that, as it defines a fixture in the object editor.

Regarding the error, I think physics functions return that error if the calling instance is not a physics object. You will want to use a with() statement in that case.
 
Top