I am trying to not get contact with caveman and other images with collision bitmasks but my caveman hits everything.
func addCaveManBitMasks(){
caveManNode.physicsBody?.categoryBitMask = PhysicsCategory.caveman
caveManNode.physicsBody?.contactTestBitMask = PhysicsCategory.tri | PhysicsCategory.trex | PhysicsCategory.newblock | PhysicsCategory.fireBall | PhysicsCategory.waterblock | PhysicsCategory.secondwaterblock | PhysicsCategory.star
caveManNode.physicsBody?.collisionBitMask = PhysicsCategory.newblock
}
func addTriBitMasks(){
triImage.physicsBody?.categoryBitMask = PhysicsCategory.tri
triImage.physicsBody?.contactTestBitMask = PhysicsCategory.caveman
triImage.physicsBody?.collisionBitMask = 0
}
func addRexBitMasks(){
tRexImage.physicsBody?.categoryBitMask = PhysicsCategory.trex
tRexImage.physicsBody?.contactTestBitMask = PhysicsCategory.caveman
tRexImage.physicsBody?.collisionBitMask = 0
}
func addNewBlockManBitMasks(){
newBlockImageNode.physicsBody?.categoryBitMask = PhysicsCategory.newblock
newBlockImageNode.physicsBody?.contactTestBitMask = PhysicsCategory.caveman | PhysicsCategory.steg
newBlockImageNode.physicsBody?.collisionBitMask = PhysicsCategory.caveman
}
func addFireBallBitMasks(){
fireBall.physicsBody?.categoryBitMask = PhysicsCategory.fireBall
fireBall.physicsBody?.contactTestBitMask = PhysicsCategory.caveman
fireBall.physicsBody?.collisionBitMask = 0
}
func addStarBitMasks(){
onScreenStar.physicsBody?.categoryBitMask = PhysicsCategory.star
onScreenStar.physicsBody?.contactTestBitMask = PhysicsCategory.caveman
onScreenStar.physicsBody?.collisionBitMask = 0
}
struct PhysicsCategory {
static let caveman: UInt32 = 0x1 << 0
static let tri: UInt32 = 0x1 << 1
static let trex: UInt32 = 0x1 << 2
static let fireBall: UInt32 = 0x1 << 3
static let steg: UInt32 = 0x1 << 4
static let ptero: UInt32 = 0x1 << 5
static let waterblock: UInt32 = 0x1 << 6
static let secondwaterblock: UInt32 = 0x1 << 7
static let newblock: UInt32 = 0x1 << 8
static let star: UInt32 = 0x1 << 9
static let food: UInt32 = 0x1 << 10
}
the tri, rex, fireball, and newblock don't contact with one another which is perfect, but I also need the caveman to do the same. Caveman should only collide with the new block which it does. I am very confused and an explanation would be much appreciated