Can anyone expound this Projectile Motion computation please?

31 Views Asked by At

I have this formula for projectile motion that I'm using in Unity for getting the low or high direction of a shot, and it works. However, I'd love to understand the equation.

And notably,

  1. Why force was raised to the power of 4?
  2. How to understand what's happening in P?
  3. For the low and high vectors, how did it manage to get the right angles?
  4. What formula in Projectile Motion was this derived from?
Vector3 dir = target - origin;

float v2 = force * force;
float v4 = v2 * v2;
float g = -Physics.gravity.y;
float x = dir.x;
float y = dir.y;
float P = v4 - g * (g * x * x + 2f * y * v2);

float sq = Mathf.Sqrt(P);

low = new Vector3(g * x, v2 - sq);
high = new Vector3(g * x, v2 + sq);

Apologies as I'm not well-versed with many math equations e.q. trigo, calculus, even though I'm a programmer.

I hope you understand my plight and thanks in advance.