Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit.
Showing this is simple enough: I rotate the ball by its angular velocity every tick and apply the same rotation when it's rendered.
When a ball hits a wall, I know that the speed of rotation is affected by...
- the ball's initial speed when hitting the surface
- the friction coefficients of the ball and surface (physical constants)
- the angle of incidence (the angle between the ball's incoming velocity vector and the surface normal).
The angle of incidence is approximated by the dot product of the ball's impact and exit velocity vectors. (1 meaning high spin, -1 meaning no spin, and everything else relatively in between)
Multiplying all of the above together and making sure they were then transformed to the range 0 - 1, and multiplied by max rotation speed, the ball seemed to respond in rotation speed as expected. Except for one thing: It would always rotate clock-wise (because of positive values).
Is this a good method? Can you think of a simpler way?
If this method seems fine, what am I missing? How do I know when the ball should be rotating counter-clockwise?