I am having trouble getting 2 different spawn objects not to collide with each other. I am using the Collision guide from the website as a reference, but everything I have tried doesn’t work.It should be noted both spawn objects are coming from the same module.Thanks in advance!
Here my code
[lua]
local function addspawn ( )
local spawnCollisionFilter = { categoryBits =4, maskBits =5 }
local spawn = Spawn.new(10, 10, physics)
spawn.objectType = “food”
spawn.isFixedRotation = true
spawn.speedFactor = 1
spawn.isBullet = true
spawn:applyForce( 1, 0, spawn.x, spawn.y )
physics.addBody( spawn, “dynamic”, {density=0.1,filter=spawnCollisionFilter} )
world:insert(spawn)
print( “Working REpeat” )
end
timerId = timer.performWithDelay( 1000, addspawn ,-1 )
local function addspawn2 ( )
local GreenCollisionFilter = { categoryBits =2, maskBits =3 }
local spawn2 = Spawn.new(10, 10, physics)
spawn2.objectType = “food3”
spawn2:setFillColor( 0, 255, 0 )
spawn2.isFixedRotation = true
spawn2.speedFactor = 1
spawn2.isBullet = true
spawn2:applyForce( 0, 1, spawn2.x, spawn2.y )
spawn2.y = .3
physics.addBody( spawn2, “dynamic”, {density=0.1,filter=GreenCollisionFilter} )
world:insert(spawn2)
print( “Working REpeat2” )
end
timerId = timer.performWithDelay( 1000, addspawn2 ,-1 )
[/lua]