if ((catA & maskB) != 0 && (catB & maskA) != 0)
It is in Box2d’s manual: 6.2, and is used to check if two objects should collide (after filtering)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
catA is a bit field of collision categories for object A
maskA is a bit field of categories that object A can collide with.
For example:
catA & maskB means the bits that are 1 in both catA and maskB, so
1000000000000000. It’s not 0, because Object B can collide with objects in the highest bit, and object A has that bit set.catB & maskA means the bits that are 1 in both catB and maskA, so
0000100000000000. It’s also not zero since Object A can collide with objects in the 5th highest bit category, and Object B is in that category.So the two objects can collide.