Page 1 of 1
curved ball movement
Posted: Mon Nov 21, 2011 7:19 am
by quaikohc
hi
what would be the best way to implement this kind of befaviour
http://www.youtube.com/watch?v=uWPIcDgbyZI using bepu? i mean curved movement of a ball when it was hit by fast moving block
Re: curved ball movement
Posted: Mon Nov 21, 2011 7:36 am
by Norbo
If you mean the ball curving in midair, then what you're looking for is the
Magnus effect.
Basically, each frame, you could do something like this:
Code: Select all
ball.LinearMomentum += (dt * curvingCoefficient) * Vector3.Cross(ball.AngularVelocity, ball.LinearVelocity);
If you find that an impact does not generate sufficient angular velocity to trigger the effect to your satisfaction, you can impart a greater angular impulse using a collision event or something along those lines. You could also fake the effect by getting the 'angular velocity' value from somewhere other than the ball's true angular velocity.