Spin ball physics

Topics: Developer Forum
Mar 27, 2011 at 6:04 PM
Edited Mar 27, 2011 at 6:05 PM

Hey. I've got a ball object to which I'm applying an impulse to. I'd also like to apply spin to the ball, so I set its angular velocity. This causes the ball to curve off course but I'd like to have it curve back on course (like a soccer free kick). How would I go about applying a Magnus force to the ball so that it curves back onto the original trajectory instead of simply away from the point of origin. At the moment, I've got this:

//initial impulses

 

ball.ApplyLinearImpulse(new Vector2(0, 1.3f));
ball.ApplyAngularImpulse(-30.0f);

 

//called every loop

 

float ax = (float)(-0.5 * ball.Revolutions * ball.LinearVelocity.Y);
float ay = (float)(0.5 * ball.Revolutions * ball.LinearVelocity.X);
ball.ApplyForce(new Vector2(ax, ay));

 

However, I'm not sure if this is correct (I'm guessing it's not). Any ideas?

Thanks