Instead of calculating distance between 1 object and another, can I calculate the distance between an object and another, can I calculate the distance using the ‘arch’ an object with dynamics has (like a mortar firing)? Here’s my example:

Most of the trajectory equations can also be found here. I’m not 100% sure whether you’re trying to get the horizontal distance or the arc length, so I’ve included both, and luckily `Mathf`

has all the functionality we need:

```
private static float GRAVITY = 9.8067f;
public static float GetHorizontalDistance(float velocity, float launchAngle, bool degrees = false)
{
// convert to radians if necessary
if (degrees)
{
launchAngle *= Mathf.Deg2Rad;
}
return (velocity * velocity * Mathf.Sin(2.0f * launchAngle)) / GRAVITY;
}
public static float GetArcLength(float velocity, float launchAngle, bool degrees = false)
{
// convert to radians if necessary
if (degrees)
{
launchAngle *= Mathf.Deg2Rad;
}
// pre-calculate sine and cosine of launchAngle and square of velocity
float sinAngle = Mathf.Sin(launchAngle);
float cosAngle = Mathf.Cos(launchAngle);
float vSquared = velocity * velocity;
return (vSquared * (sinAngle + cosAngle * Mathf.Log((1.0f + sinAngle) / cosAngle))) / GRAVITY;
}
```

You may need to swap out the const GRAVITY for Unity’s value, depending on your usage case.