The collision filters and collision events work fine. I have one game that is completely built around them and I haven’t run into any issues. I personally always use the old school collision filters as described in the docs. You probably just have an oversight somewhere in your code or in the plugin.
Try out the following code. It should work as you described. I copied a simple collision event from the docs and added two settings for filterObject that you can try out.
local physics = require("physics") physics.setDrawMode( "hybrid" ) physics.start() -- uncomment one of these -- local filterObject = { categoryBits=1, maskBits=1 } -- maskBits=1 results in no collision with filterGround local filterObject = { categoryBits=1, maskBits=3 } -- maskBits=3 results in collision with filterGround local filterGround = { categoryBits=2, maskBits=1 } local function onLocalCollision( self, event ) if ( event.phase == "began" ) then print( self.myName .. ": collision began with " .. event.other.myName ) end end local ground = display.newRect( 240, 240, 320, 40 ) physics.addBody( ground, "static", {filter=filterGround} ) ground.myName = "ground" ground.collision = onLocalCollision ground:addEventListener( "collision" ) local rect = display.newRect( 240, 40, 80, 20 ) physics.addBody( rect, "dynamic", { chain={ -40,-10,40,-10,40,10,-40,10 }, connectFirstAndLastChainVertex = true, filter=filterObject } ) rect.myName = "rect" rect.collision = onLocalCollision rect:addEventListener( "collision" )
I’ve created an excel file for easy collision filter setup. If you need it, I can upload it here for you tomorrow.
Update: I tried giving both objects chain physics bodies and it seems that if both objects are made out of chains, then they don’t collide regardless of the collision filter values.