Hi, Im having some troubles, not actually coding (maybe) but perhaps math problems, Here’s the thing.

I have some kind of AI who makes shoots at you in a parabolic trayectory, now, I dont know how to succesfully calculate the force neded to apply into te proyectile in order to reach the target, I only know the distance betwen the shoter and the target with

Vector3 target;

Vector3 distanceFromTarget = target - transform.position;

im giving some “randomish” angle to shot, based on the obstacles the AI have on his way but giving some angles more than 0 and below than 90, i cannot calculate the initial velocity.

Im using Unity Physix for the bullets, when I shoot them it works well, I can manually calculate my trayectory and do some “Test and error” shots but, the AI must be capable of calculate the same parameters with a formula.

Here’s the code i have right now:

```
void GetElevationDirection()
{
targetPosition = currenTarget.transform.position;
vectorResultante = targetPosition - cannonPlace;
estimatedElevation = Random.Range(30, 50);
float finalAngle = estimatedElevation * 2;
finalAngle = Mathf.Sin(finalAngle * Mathf.Deg2Rad);
float gx = 9.81F * vectorResultante.magnitude;
estimatedSpeed = Mathf.Sqrt(gx / finalAngle);
//estimatedSpeed *= 1.25F;
estimatedElevation *= -1;
}
```

I need to multiply at the end the “estimatedElevation” variable because when I rotate the 3D model of the cannon, it have inverted X axis and in that way the cannon points up and not down, but the estimated speed, is to low, even with the 25% increment, and somethimes I get an error on the Matfh.Sqrt because the “gx / finalAngle” division gets negative. I hope that someone can help me…