M
maelstrom
Guest
Getting an unusual error when I changed an object from using the GUI physics settings to manually assigning the physics settings...
############################################################################################
ERROR in
action number 1
of Create Event
for object obj_obstacle:
The instance does not have an associated physics representation
at gml_Object_obj_obstacle_CreateEvent_1 (line 9) - physics_set_density(fixture,0);
#####################################################################
previously, when I created the object with the GUI physics settings, it threw no errors
incidentally, if I don't place the object in a room, there's no error, but throws the error when I place it in the room
creation code is as follows...
var fixture = physics_fixture_create();
physics_fixture_set_box_shape(fixture, sprite_width/2, sprite_height/2);
physics_set_density(fixture,0);
physics_set_restitution(fixture,0.2);
physics_fixture_set_friction(fixture, 0.5);
my_fix = physics_fixture_bind(fixture, id);
physics_fixture_delete(fixture);
Additional Notes
the room uses 3D and like I said, I've had no errors up til now. It's only when I assigned the physics manually to the object the error appeared. I've tried changing the room's instance order so its at the top, bottom, etc...
The reason why I wanted to assign the physics manually, is that I need a mechanism to turn on/off physical collisions for this object, arbitrarily. I assumed I'd use physics_fixture_set_sensor(fixture, state), where 'fixture' is the 'my_fix' pointer I have in my code above. Not sure this works but was willing to give it a try - if anyone has a better suggestion I'd be happy to hear it.
############################################################################################
ERROR in
action number 1
of Create Event
for object obj_obstacle:
The instance does not have an associated physics representation
at gml_Object_obj_obstacle_CreateEvent_1 (line 9) - physics_set_density(fixture,0);
#####################################################################
previously, when I created the object with the GUI physics settings, it threw no errors
incidentally, if I don't place the object in a room, there's no error, but throws the error when I place it in the room
creation code is as follows...
var fixture = physics_fixture_create();
physics_fixture_set_box_shape(fixture, sprite_width/2, sprite_height/2);
physics_set_density(fixture,0);
physics_set_restitution(fixture,0.2);
physics_fixture_set_friction(fixture, 0.5);
my_fix = physics_fixture_bind(fixture, id);
physics_fixture_delete(fixture);
Additional Notes
the room uses 3D and like I said, I've had no errors up til now. It's only when I assigned the physics manually to the object the error appeared. I've tried changing the room's instance order so its at the top, bottom, etc...
The reason why I wanted to assign the physics manually, is that I need a mechanism to turn on/off physical collisions for this object, arbitrarily. I assumed I'd use physics_fixture_set_sensor(fixture, state), where 'fixture' is the 'my_fix' pointer I have in my code above. Not sure this works but was willing to give it a try - if anyone has a better suggestion I'd be happy to hear it.