Driving Range Simulator

Tyler Fox

CPE 471 Spring 2016


For my project I decided to create a program that modeled the flight path of a golf ball being hit at a driving range. The idea was to create a visually appealing scene, similar to how a driving range looks, and have the user hit balls that would have different trajectories and distances. In additiion, the flight path of the golf ball is drawn in order to show the trajectory of the shot to the user, and the distance traveled is reported.


The first step of my design was to make the driving range appear to be in a visually appealing location. To accomplish this, I created a skybox and ground plane and mapped a texture to each surface. A skybox is essentially a giant cube that envelopes your scene. I also added four stakes (red, white, blue, yellow) that stretch down the middle of the driving range and represent distances of 100, 150, 200 and 250 yards respectively. Next I wrote functions in C++ to model the flight path of the golf ball. Modeling the flight path of a golf ball actually requires extremely complicated aerodynamics, so I settled on simpler parabolic motion. In addition, I added a vector of semi-random magnitude that pointed in a random direction parallel to the ground plane. This random vector was then used to create another equation which essentially applied randomness to each shot. When this random vector was added to my parabolic equation, I was able to simulate four different shot types (push, pull, hook, slice), as well as fairly straight shots. In addition, my program also features a virtual camera that allows the user to move/look around my world and it also outputs how far each shot went in yards.

How to Use the Driving Range

Using the driving range is quite simple. To hit a shot, simply press the space bar, and my program will do the rest. The mouse is used to look around the world, and the following keys are used to move around the driving range.

'w' - Move forward.

'a' - Move left.

's' - Move backwards.

'd' - Move right.

'esc' - Quit.

Sample Images

The driving range on startup:

Pretty nice looking draw here:

An example of a fade:

Aerial view of the driving range:

Side view of the driving range:


If you're interested in reading more about the complex physics behind a golf ball in flight check this out!
More Information on Physics of a Golf