Jezla
Member
I've just filed a bug report on this, but I thought I'd post here so anyone encountering this issue can find some information on it, especially since the Box2D tutorials have been re-published, and more people might be trying their hand at it.
I've noticed that sometimes, when using the physics system in GMS2, that fixtures defined in the object editor do not work when the game is run. The instances do not have a physics representation. Objects with their physics properties and fixtures defined and bound via code do not have this problem.
I've realized that the issue only appears when the physics world is created via code. If the physics world is created by ticking the physics box in the room editor, then all fixtures are correctly created and bound, regardless how they are defined.
Here is a sample project to import to see this issue at work. The project currently has the physics world defined via code, with one static object and three dynamic objects. Two of the dynamic objects have fixtures set in the object editor, the third is set via code. Debug drawing is ON. When the project runs, only the code-defined fixtures are created. If you remove the "oPhysics" instance from the room and tick the physics box in the room editor, then everything works as it should.
The work-around is simple, fortunately. If you define your physics world via code, then everything must be done via code.
I've noticed that sometimes, when using the physics system in GMS2, that fixtures defined in the object editor do not work when the game is run. The instances do not have a physics representation. Objects with their physics properties and fixtures defined and bound via code do not have this problem.
I've realized that the issue only appears when the physics world is created via code. If the physics world is created by ticking the physics box in the room editor, then all fixtures are correctly created and bound, regardless how they are defined.
Here is a sample project to import to see this issue at work. The project currently has the physics world defined via code, with one static object and three dynamic objects. Two of the dynamic objects have fixtures set in the object editor, the third is set via code. Debug drawing is ON. When the project runs, only the code-defined fixtures are created. If you remove the "oPhysics" instance from the room and tick the physics box in the room editor, then everything works as it should.
The work-around is simple, fortunately. If you define your physics world via code, then everything must be done via code.