- Home /
Force to reach point
Can anyone help me to calculate the force to apply to a ball for reach a position? Here's the scenario: my player is throwing a ball to an enemy. When he throws the ball he's looking at the enemy (using LookAt) but the ball start from an offset from the player. If i apply a force Vector(0,0,50) (example) and then trasform it, the ball starts in front of the player but it doesn't reach correctly the target enemy because of the start-offset :/
Answer by robertbu · Aug 18, 2013 at 04:49 PM
Posting your source would help us give you a more detailed answer. I suggest that you have the ball look at the target and then move the ball forward on its forward. So right after you instantiate the ball:
ball.transform.LookAt(target);
ball.rigidbody.addForce(ball.transform.forward * 1000);
Note if gravity is enabled on the ball, it will hit low due to the pull of gravity.
Your answer
![](https://koobas.hobune.stream/wayback/20220613112448im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Returning a rigidbody back to its original x and z rotations through physics forces. 2 Answers
Make object stick to the ground in 2D 2 Answers
ForceMode.Acceleration estimated dst != covered dst with a single Addforce in effect 1 Answer
How to make a object jump constantly at y and move to the next position to z (perfectly) 0 Answers
Can I have a rigidbody continue to calculate physics while being dragged by code? 2 Answers