I have two nodes, and I want to detect a collision between them, but for some reason
func didBegin(_ contact: SKPhysicsContact) {
is not being called.
It is a ball and a paddle:
ball.physicsBody?.categoryBitMask = 2
ball.physicsBody?.contactTestBitMask = 2
ball.physicsBody?.isDynamic = true
main.physicsBody?.categoryBitMask = 1
main.physicsBody?.contactTestBitMask = 1
main.physicsBody?.isDynamic = false
_
func didBegin(_ contact: SKPhysicsContact) {
print("Collision") //Obviously this will be better in future, but I need to detect collision for a start
}
When the ball moves around, it DOES bounce off the paddle, but I need to be able to detect that.
Thanks