This is a pretty easy question, but I can't quite figure out the answer. I have:

  1. The initial position of a projectile.
  2. The gravity vector.
  3. The (stationary) target I want to hit.
  4. A maximum launch speed of the projectile.

I want to calculate the initial velocity the projectile must be launched at to hit the target, assuming it follows a ballistic trajectory.

  • \$\begingroup\$ My answer here (gamedev.stackexchange.com/questions/54732/…) provides the kinematic equations for motion under constant acceleration. This is adequate whenever your projectile never rises too far above the Earth's surface, so that gravity can be assumed constant. \$\endgroup\$ Commented Dec 29, 2014 at 22:11
  • \$\begingroup\$ Thank you, but these are the forward equations (i.e given v_0 and g, where will it be at time t?). Further, they are in only one dimension. What I need is a re-arrangement of these equations to infer v_0 from a target and g. \$\endgroup\$
    – mklingen
    Commented Dec 29, 2014 at 22:30
  • \$\begingroup\$ Ah, I see, I just needed to do a bit of algebra and I found it! \$\endgroup\$
    – mklingen
    Commented Dec 29, 2014 at 22:38

1 Answer 1


I solved it thanks to one of the comments:

Vector3 displacement = (end - start);
float dist = displacement.Length();
float T = dist / MaxSpeed;
Vector3 initial_velocity = 1.0f/T*(displacement) - 0.5f*Gravity*T;

Not the answer you're looking for? Browse other questions tagged .