You can use the following method:
cone.setContactFilter ( categoryBits , groupIndex , maskBits );
where the cone is an object of type ConeLight . Now this light will ignore bodies having the specified categories Bits, groupIndex and maskBits.
You can set the Bits, groupIndex and maskBits categories through the body mount in the following way -
fixture.filter.categoryBits = your value;
(categoryBits: collision category bit. Usually you just set one bit.)
fixture.filter.groupIndex = your value;
(groupIndex: collision groups allow a particular group of objects to never collide (negatively) or always collide (positively). no collision group. Nonzero group filtering always wins against the mask bit.)
fixture.filter.maskBits = your value
(maskBits: bit of the collision mask. It indicates the categories this form will take for the collision.)
If you want some bodies to ignore ALL LIGHTS.then, you can use the following Light .setContactFilter (categoryBits, groupIndex, maskBits)
aug13 source share