I'm building a relatively simple game in SpriteKit where you can bounce a ball based on a user's touch location, using something like ball.physicsBody.applyImpulse(someVector).
I've been trying to understand how to gravity and vectors work by playing with the values of the physicsWorld.gravity vector and the vector of impulse I apply on the ball and I think I need some clarification;
If I use this code:
self.physicsWorld.gravity = CGVectorMake(0, -10)
ball.physicsBody.applyImpulse(CGVectorMake(0, 10))
Shouldn't the ball, based on this code and according to common sense not move at all, as the pulling and pushing forces are equal, or at least go up the exact distance of 10 before starting to fall in this case?
In reality what happens is that the ball does bounce up and is going a distance of over 10 pixels up.
Why is it behaving like that, and what exact value do I need to use for the vectors to cancel out so that the ball remains completely still?
I'd be happy for any sort of explanation, Thanks in advance.