Hi
Filter collision is probably one of the hardest part of Box2d.
In documentation the ShouldCollide example has syntax bug.
Should be :
Isn't there any way to register a b2ContactFilter ?
Overrided ShouldCollide() is never called.
About Collision Bits now
Do you think it's better to do like this :
Or values should be rather like that :
The thing is I found it very hard to setup correctly my player collision mask.
Player should collide with everything at certain moment (see FULL_MASK_BITS)
Sometimes Golfball must pass through (see PLAYER_MASK_BITS) when refiltering.
And a certain kind of object (PLAYERONLY) shall never collide with anything except player.
I know it sound confusing but I'm wondering if it's the good way to setup collision filters since everything work like that.
Thanks if you can help
Filter collision is probably one of the hardest part of Box2d.
In documentation the ShouldCollide example has syntax bug.
Should be :
Local Collide:Int = (filter1.GetMaskBits() & filter2.GetCategoryBits()) <> 0 And .. (filter1.GetCategoryBits() & filter2.GetMaskBits()) <> 0 return collide
Isn't there any way to register a b2ContactFilter ?
Overrided ShouldCollide() is never called.
About Collision Bits now
Do you think it's better to do like this :
Const PLAYERONLY_COLLISION_BYTE:Short = $0001:Short Const GOLFBALL_COLLISION_BYTE:Short = $0002:Short Const GOLFBALL_SENSOR_COLLISION_BYTE:Short = $0004:Short Const OBJECT_COLLISION_BYTE:Short = $0008:Short Const PLAYER_COLLISION_BYTE:Short = $0016:Short Const HOLE_COLLISION_BYTE:Short = $00032:Short Const GROUND_COLLISION_BYTE:Short = $0064:Short
Or values should be rather like that :
Const PLAYERONLY_COLLISION_BYTE:Short = $0001:Short Const GOLFBALL_COLLISION_BYTE:Short = $0002:Short Const GOLFBALL_SENSOR_COLLISION_BYTE:Short = $0004:Short Const OBJECT_COLLISION_BYTE:Short = $0008:Short Const PLAYER_COLLISION_BYTE:Short = $0010:Short '$0010:Short = 16 Const HOLE_COLLISION_BYTE:Short = $00020:Short '$0020:Short = 32 Const GROUND_COLLISION_BYTE:Short = $0040:Short '$0040:Short = 64
The thing is I found it very hard to setup correctly my player collision mask.
Player should collide with everything at certain moment (see FULL_MASK_BITS)
Sometimes Golfball must pass through (see PLAYER_MASK_BITS) when refiltering.
And a certain kind of object (PLAYERONLY) shall never collide with anything except player.
Const FULL_MASK_BITS:Short = $FFFF:Short Const PLAYER_MASK_BITS:Short = $FFFF:Short ~ GOLFBALL_COLLISION_BYTE Const PLAYERONLY_MASK_BITS:Short = $FFFF:Short ~ OBJECT_COLLISION_BYTE ~ GOLFBALL_COLLISION_BYTE ~ GOLFBALL_SENSOR_COLLISION_BYTE ~ HOLE_COLLISION_BYTE ~ GROUND_COLLISION_BYTE
I know it sound confusing but I'm wondering if it's the good way to setup collision filters since everything work like that.
Thanks if you can help