For an archer in my game, I want to calculate the launch angle to hit a point (x,y) when fired from (0,0). The initial power is known, so I use the following formula: https://en.wikipedia.org/wiki/Projectile_motion#Angle_%CE%B8_required_to_hit_coordinate_(x,_y) Formula

The problem is that the arrow is not a point and depending on the angle the archer shoots at, only the location of the base of the arrow is constant. The displacements from the base of the arrow to the center of the arrow, which is the center of gravity and the arrow tip are dependent on the angle. These displacements are of the form (cos(theta), sin(theta)) * r where r is some constant. i.e. the arrow is rotated by the aim angle around its base. As the arrow travels through the air it is rotated around its center to face the direction it is moving.

How can I calculate the angle required for the tip of the arrow to hit a point?

Example to illustrate (two different angles, base of arrow = blue, center of gravity = green, tip of arrow = red):



1 Answer 1


Myself, I would solve this by insisting that the point I'm calculating for always represents the tip of the arrow — just possibly back in time. 😉 That way all your standard physics formulas still work fine as is, and we just need to adjust the visuals a little.

If at the moment the player sees the arrow fire, the arrow base is the point at (0,0), I'd pretend the arrow actually "fired" a tiny fraction of a second in the past — the tip passed through (0, 0), invisibly, and emerged on the other side to where the player sees it now, a fraction of a second later.

So, use your angle calculation as normal. Then compute the point on the resulting parabola 1 arrow length from the firing point — a tiny bit forward in time along its trajectory. When you draw the visible arrow in the aiming pose or at the moment of release, draw it with the angle that puts the tip at that point (which in general will be a tiny hair shallower than the angle at time 0).

If your computed velocity is \$\vec v\$ and the arrow has length \$l\$, this will be well approximated by the time \$t_* = \frac l {||\vec v||}\$ and the point to aim the arrow tip at will be:

$$\vec p(t_*) = \vec p_0 + \vec v \cdot t_* + \frac {\vec g} 2 \cdot t_*^2$$

You'll also likely want to move the arrow asset's pivot so it's at its tip — this is reasonably well justified as the arrow head is the heaviest part, so the center of mass will be closer to the front than to the back.


You must log in to answer this question.

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