How can I prevent two sprite nodes from being tilted when colliding. Let say I have a long rectangle with PhysicsBody 1 and a short rectangle with PhysicsBody 2. I want these 2 to hit, but don't want the long rectangle to be tilted after colliding but still standing straight. How can I achieve that? This is the code for the long rectangle:
thePlayer.position = CGPoint(x: 100 - self.frame.size.width/2, y: 100 - self.frame.size.height/2)
thePlayer.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: 40, height: 40))
thePlayer.physicsBody?.categoryBitMask = gamePhysics.Player
thePlayer.physicsBody?.collisionBitMask = gamePhysics.Wall
thePlayer.physicsBody?.contactTestBitMask = gamePhysics.Wall
thePlayer.physicsBody?.isDynamic = true
thePlayer.physicsBody?.affectedByGravity = false
This is the code for the short rectangle:
tileNode.position = CGPoint(x: x, y: y)
tileNode.physicsBody = SKPhysicsBody.init(rectangleOf: tileSize, center: CGPoint(x: tileSize.width / 2.0, y: tileSize.height / 2.0))
tileNode.physicsBody?.categoryBitMask = gamePhysics.Wall
tileNode.physicsBody?.collisionBitMask = gamePhysics.Player
tileNode.physicsBody?.contactTestBitMask = gamePhysics.Player
tileNode.physicsBody?.isDynamic = false