I have a player game object that contains three collision objects. Each one is for a specific state of the player object. So at any one time, only one is active
when the level starts I disable the two unwanted collision objects using (as an example)
local body = b2d.get_body(“#collision_crouch”)
b2d.body.set_active(body, false)
the problem is that when you do this within a trigger collision object it generates a “trigger response” with the “message.enter” value equalling false.
is this a bug or just a quirk of how the physic engine work?
when you crouch, the set_crouch function swaps over the collision object which generates an enter and then an exited message in the trigger object on the same frame
I have managed to get around the issue by changing the collision type in these zones from “trigger” to “collision”. Their scripts have been adjusted so that they have a current and previous states variable. So if previous is false and current is true then the player has entered the zone.