- Home /
Add Force to In Direction Object is Moving
I'm making a game of Pong and I want the ball to accelerate, but the ball is moving back and forth in opposite directions, I want to know how to get the ball to have force added in the direction it's already moving in, so when the ball is moving left, it applies -10 force a second, and when it's moving right it will apply +10 force a second, anyone know how to do this?
Answer by syclamoth · Mar 24, 2012 at 12:21 AM
Well, since rigidbodies already know what direction they're moving in, try something like this:
rigidbody.AddForce(rigidbody.velocity.normalized * Time.deltaTime * forceAmount);
That should make your rigidbody accellerate further in its current direction.
Your answer
Follow this Question
Related Questions
Simple rigidbody.AddForce only applying once each time key is pressed 1 Answer
Is Add Force The Best Solution 1 Answer
Move object invertically to another 0 Answers
Have player fall down with platform? 0 Answers
Smooth dashing issues 0 Answers