- Home /
Question by
andre9875 · Apr 21, 2010 at 01:08 AM ·
rigidbodyvelocityaddforceaddcomponent
Football free kick question?
Is it possible to simulate football free kick? (bend like Beckham). I was able to make straight kicks, no problem by using rigidbody.velocity and rigidbody.addForce.
if(!target.rigidbody) target.AddComponent ("Rigidbody");
target.rigidbody.velocity.y = kick_velocity;
target.rigidbody.AddForce (forward * kick_force);
Thanks
Comment
Answer by spinaljack · Apr 21, 2010 at 01:22 AM
You can add a constant force to make the ball curve in the air, you can do this in during FixedUpdate so that it is applied every physics step over several frames.
function FixedUpdate(){
if(isCurve){
rigidbody.AddForce(Vector3.right*curveForce);
}
}
Your answer
Follow this Question
Related Questions
AddForce vs Velocity issues with Rigidbody2D 2 Answers
How to mix velocity with addForce? 1 Answer
Moving a camera with AddFoce, or setting velocity, need help 1 Answer
Rigidbody Enemy and Collisions 2 Answers
2D metroid boost ball 0 Answers