Open snowkittykira opened 5 months ago
Do we still want the behavior to keep Categories number as target (1 to 16) or their integer values 2^category_number ? like could I set by hand setCollisionmask(Shape1, Shape2) and it would be the same as setCollisionMask(3) ? or should setCollisionMask(3) have to set the Category number 3 to true ?
Currently a fixture/shape needs to have in its mask every category that it doesn't want to collide with, which is the opposite of how it works in box2d
fixture:getMask says "Returns which categories this fixture should NOT collide with. " https://love2d.org/wiki/Fixture:getMask
the box2d documentation says "The categoryBits flag can be thought of as the fixture saying 'I am a ...', and the maskBits is like saying 'I will collide with a ...'." https://www.iforce2d.net/b2dtut/collision-filtering
This is awkward for a few reasons:
the inversion that love2d does can be seen here and on the corresponding functions in Fixture.cpp: https://github.com/love2d/love/blob/d5766924ed7fa70ac8f092e725860c51e3fa873d/src/modules/physics/box2d/Shape.cpp#L281
I'm suggesting that in love 12 the API be simplified to do the same thing as the corresponding box2d functionality. If appropriate the functions could be renamed to "setCollisionMask" from "setMask" for backwards compatibility and to make it clearer that the mask says which things an object will collide with.