This paper introduces a practical analytical approximation of projectile trajectories in 2D and 3D roughly based on a linear drag model and explores a variety of different planning algorithms for these trajectories. Although the trajectories are only approximate, they still capture many of the characteristics of a real projectile in free fall under the influence of an invariant wind, gravitational pull, and terminal velocity, while the required math for these trajectories and planners is still simple enough to efficiently run on almost all modern hardware devices. Together, these properties make the proposed approach particularly useful for real-time applications where accuracy and performance need to be carefully balanced, such as in computer games.

A ballistic trajectory is the path of an object that is dropped, thrown, served, launched, or shot but has no active propulsion during its actual flight. Consequently, the trajectory is fully determined by a given initial velocity and the effects of gravity and air resistance. Mortars, bullets, particles, and jumping computer game characters (between key presses) are all examples of ballistics, while actively controlled aircraft and rocket-propelled grenades are not.

Describing the exact motion of an object in free fall is a classic problem that can become quite complex when including effects like drag, turbulence, height-dependent medium pressure, position-dependent gravity, buoyancy, lift, and rotation. For this research paper, the problem will be approached on a relatively pragmatic level, as it will be based on a reasonably simple drag model that does not consider the dynamics of projectile rotation and assumes that wind, gravity, and terminal velocity all remain fixed over the whole trajectory. As a result, some accuracy will be sacrificed for the sake of computational efficiency and flexibility in practical use, while still maintaining much of the essence of the ballistic motion through a resistive medium. Although such a choice does not make much sense for most scientific and military applications, it does make sense for computer games, where performance is typically more important than physical correctness.

Currently, computer games hardly ever use trajectories influenced by air resistance when complex planning is required. That might partially be because implementing a computer player that is capable of quickly calculating the ideal angle to fire a mortar with a fixed initial speed to hit a given target, for example, is harder when having to take into account drag and wind conditions. In fact, the added complexity and computational intensity that would be required for working with many of the current drag models might simply not be justifiable.

This paper introduces a trajectory model that is designed to fit in the gap where working with accurate models would be too complex and working with simple dragless parabola-shaped trajectories would be insufficient. The proposed model’s use and practicality will be demonstrated by covering a number of its properties and showing how these trajectories can be planned in a variety of ways.

In Section

}

}

The motion of ballistic projectiles has been covered in many physics papers and textbooks, and all of these use their own set of assumptions to create an approximate model of the forces acting on a projectile. Although some ballistics research focuses on effects like shape and orientation [

The used drag model influences both realism and computational complexity. For example, when no drag force is applied, the trajectory will always be a parabola, which is easy to work with and plan for. If the drag force is chosen to be linear in velocity, an explicit function describing the trajectory can be found by solving a set of linear differential equations [

The research in this paper is based on a novel approximation of the trajectory function that follows from the linear drag model, sacrificing some of its moderate accuracy for a further increase in both efficiency and flexibility.

Before presenting the proposed trajectory function and its properties, the necessary ballistic parameters will be defined here first. Starting with a general note, vector variables in this paper are always distinguished from scalar variables by the

A ballistic object is assumed to be launched from the initial position ^{2} for “earthly” applications. The amount of drag

Here,

Together,

Serving a tennis ball from the Empire State Building upwind.

In terms of the parameters defined above, the differential equation for the exact linear drag model has the following analytic solution:

This function calculates the 2D or 3D position

The function above will not be used directly in this paper. Instead, it will be approximated by substituting its exponential function

Approximating

When the exponential function in

Because of the aforementioned properties,

As ^{2}). The different drag models are calibrated to respect the respective ball’s terminal velocities (except for the dragless model, which always has an infinite terminal velocity).

The trajectories resulting from four models for three different ball types.

Each of the alternating thick and thin segments in the trajectories shown in Figure

When comparing the trajectories for

The function

The linearity of

The trajectory of a textured quad.

Many other useful properties can easily be derived from

The nonnegative time

This

See Figure

The velocity and

When a projectile needs to hit some given target position,

In Figure

Planning to hit all six different target positions in exactly ten seconds.

One interesting property of this function is that the

Note that the given time parameter

Planning trajectories to six targets, taking the exact same time as travelling with 25 m/s over the straight line from initial to target position.

A function for

Most planners for

Inspecting

Put into terms perhaps more familiar to computer graphics and game developers, the 2D function

A 3D trajectory with wind at an angle, and its decomposition on the principal plane (in blue).

Although there is an infinite amount of ways to define the

Here,

The frame of reference defined by

The second useful property of this principal space is that it guarantees that

The third useful property of this particular space is that it is easy to convert from world space to principal space and back as

Similarly, it is possible to efficiently convert from any world space velocity

Starting a new notational convention here for clarity, vector names (i.e., variables decorated with a

Now that the frame of reference itself has been covered, it is possible to define the two scalar functions that make up the principal space trajectory function

These functions are derived by transforming

The simpler formula for

Here,

This function always has exactly one

The same Empire State Building trajectory example as from Figure

For completeness, the principal space counterparts of the world space properties described by (

Lastly, the local slope in principal space in terms of time (i.e.,

As the planners in this section all depend on the properties of trajectories in principal space, the most relevant properties are briefly repeated here. Per definition, any ballistic object in principal space is launched from the origin, any target has a nonnegative

All planners covered here will return the exact time

To get the initial velocity in world space from these, it is possible to convert

A trajectory can be planned to pass through both position

Planning trajectories through

When looking for the time

In the example presented in Figure

Planning trajectories through six different targets, touching a line at each top.

The principal space slope

This subsection is about finding the time

This problem is actually simply a special case of the previous planner, where

Planning trajectories through six different targets, all starting with the slope 3/4.

Similarly, it is possible to hit

For this particular planner, the slope

Planning trajectories through six different targets, all ending at the slope −3/4.

The time

Planning trajectories through six different

This function is particularly intuitive to plan with when

A trajectory can also be planned to hit a target at

Like all quartic equations, solving this in a closed form is possible but difficult to do robustly [

Alternatively, when only a rough approximation of the minimal effort solution is needed, the simpler “curviness” planner from (^{2} and

Planning trajectories through six different

The last planning algorithm covered in this paper solves for the time

Note that when

Planning trajectories through six different

Using a similar approach as in the previous section, a specialized iterative solver can be implemented to solve this particular quartic function. The C++ function

As already hinted at in Section

Additionally, it is likely that the model presented in this paper can also be used for efficient exact collision detection between a trajectory and an arbitrary polygonal mesh by testing the trajectory in principal space against the intersection of the mesh and the principal plane. This algorithm might even be combined with the planners from Sections

A novel analytic approximation of ballistic trajectories with air resistance has been presented that was designed to balance physical accuracy and performance in a way that makes sense in the field of computer games.

The approximation’s linearity in velocity has been used to define a special principal frame of reference, which makes it possible to always work with these trajectories in a simplified 2D space, even though the original problem can be in 3D with wind coming from any direction. The combined result is that the proposed model is able to produce trajectories that are complex enough to be physically plausible, while keeping the math simple enough to also allow for many different ways of efficient trajectory planning that otherwise might be too impractical for use in computer games.

The author declares that there is no conflict of interests regarding the publication of this paper.