Bart
WiseBart
Hi all.
Recently I've been working on physics collisions on multiple levels using Box2D.
To achieve that, I define each level's collision mask with a different positive collision group (>0).
When the z value passes the midway point (half level height), I unbind the player's fixture, change its collision group and rebind it.
This works perfectly when no collision event is required.
Objects that need interaction, however, require a collision event.
As a consequence, the collision event is also triggered on collision with instances of a different collision group. Which is precisely what I'm trying to avoid since they're "on a different level".
Is there any way to only trigger the collision event when colliding with fixtures that are part of a certain collision group?
It seems that once you define a collision event in an object, this overrides any collision group setting.
I especially like to avoid having to check things like:
Basically I'd like the above if check to be implict in the underlying wiring.
Anyone who has experience with this?
Recently I've been working on physics collisions on multiple levels using Box2D.
To achieve that, I define each level's collision mask with a different positive collision group (>0).
When the z value passes the midway point (half level height), I unbind the player's fixture, change its collision group and rebind it.
This works perfectly when no collision event is required.
Objects that need interaction, however, require a collision event.
As a consequence, the collision event is also triggered on collision with instances of a different collision group. Which is precisely what I'm trying to avoid since they're "on a different level".
Is there any way to only trigger the collision event when colliding with fixtures that are part of a certain collision group?
It seems that once you define a collision event in an object, this overrides any collision group setting.
I especially like to avoid having to check things like:
Code:
// Object's collision event
if (level != other.level) exit;
// Further code goes here...
Anyone who has experience with this?