- Home /

# Force required to throw an object.

Hey,

I've been trying to solve this but I'm really not sure how. It's fairly simple.

I need to know how much force to apply to a rigidbody (In form of an impulse, no mass and instant change of speed), for it to go from the current position to another one given (in a Vector3) and reaching a specific height.

NOTE: The position will always be below the given height.

I found formulas but these use the time which I don't really care about...

**Answer** by Eno-Khaon
·
Nov 08, 2018 at 04:15 AM

**As a matter of fact, time is a critical factor in this calculation!**

*Why is that?*

Well, let's consider only vertical speed for a moment. If you toss a ball into the air at ~9.81 meters-per-second, it will reach its peak after 1 second of deceleration, at a height of ~4.905 meters.

*What does this mean for you?*

By utilizing *A-to-B* trajectory calculations **on flat ground** based on *time-to-destination*, exactly half of the time will be spent ascending and half will be spent descending. The horizontal motion, then, is ^{time}/_{distance} instead and, therefore, easy to calculate.

*But maybe this isn't all on flat ground.*

That's okay, too. With a target peak height in mind, you can determine how long it will take to reach the destination. **To hijack a post I made about this previously**, the peak height will be reached by:

```
groundToPeakForce = Mathf.Sqrt(2 * gravityStrength * jumpHeight);
```

In this example, gravityStrength would be the magnitude of the **physics** *gravity vector**(i.e. 9.81f)* and jumpHeight is the maximum height above the starting point. Using one of the equations for a free fall (**inverted form based on my previous answer regarding trajectories**), you wind up with this for the way down:

```
peakToGroundTime = Mathf.Sqrt(peakToGroundHeight / (gravityStrength * 0.5f));
```

Conveniently, that's the same equation for up and down, so you can calculate it once for the way up and once more for the way down:

```
float grav = Physics.gravity.magnitude;
timeToTarget = TimeToPeak(grav, currentToPeakHeight) + TimeToPeak(grav, peakToDestinationHeight);
public float TimeToPeak(float gravityStrength, float verticalDistance)
{
return Mathf.Sqrt(verticalDistance / (gravityStrength * 0.5f));
}
```

Finally, you have the key factor calculated:

**time**.

Now that you've converted all height differences into time investment, you can easily calculate the horizontal factor for the trajectory:

```
float horizontalSpeed = horizontalDistance / timeToTarget;
```

To combine all of this together, you'll first determine the vertical force required to reach the peak height, calculate the total time of the throw, then add in the horizontal force at the end:

```
float grav = Physics.gravity.magnitude;
float verticalForce = Mathf.Sqrt(2 * grav * (maxHeight - myPos.y));
float timeToTarget = TimeToPeak(grav, currentToPeakHeight) + TimeToPeak(grav, peakToDestinationHeight);
float horizontalForce = (targetPos - myPos.x) / timeToTarget;
// Described as a 2-D force because this trajectory formula fundamentally doesn't require a third dimension
Vector2 force2D = new Vector2(horizontalForce, verticalForce);
```

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

Distribute terrain in zones 3 Answers

Vibrating GameObjects 0 Answers

5.4 broke rigidbody.addForce? 0 Answers

Launch arc with physics/rigidbody problem and on Unity's internal code 1 Answer