In my game I have 2 sprites, A ball and a paddle. I'm trying to restrict the angle of reflection so that way it doesn't hit and go horizontal. I'm using this code to check the angle of contact:
var impactX = contact.contactNormal.dx
var impactY = contact.contactNormal.dy
var radiansCon: Double = Double(atan((contact.contactNormal.dy / contact.contactNormal.dx)))
var angleCon = Double(radiansCon * 180) / M_PI
//println("Bounce Angle:\(angleCon)")
if(angleCon < 60 && angleCon > 0) {
println("Adjust angle Positive")
} else if (angleCon > -60 && angleCon < 0) {
println("Adjust angle Negative")
}
How do I change the angle when the ball bounces without changing the velocity?
(I'm new to sprite kit so let me know if i am missing any details)