Game Development Reference
In-Depth Information
Physics-Based Movement
If a game requires objects to move around in the world, some form of physics will
be used to simulate the movement. Newtonian physics (also known as classical
mechanics) was formulated by Isaac Newton, among others, in the seventeenth
century. The vast majority of games utilize Newtonian physics, because it is an
excellent model so long as the objects are not moving close to the speed of light.
Newtonian physics has several different components, but this section focuses on
the most basic one: linear mechanics , which is movement without any rotational
forces applied.
I want to forewarn you before going further into this topic that classical mechanics
is an extremely comprehensive topic—that's why there is an entire college-level
class built around it. Of course, I can't fit everything within the context of this
topic (and honestly, there are enough physics textbooks out there already). So I
had to be very selective of which topics I covered—I wanted to talk about topics
that had a high change of being included in a game written by someone who's in
the target audience for this topic.
Linear Mechanics Overview
The two cornerstones of linear mechanics are force and mass. Force is an influen-
ce that can cause an object to move. Force has a magnitude and a direction, and
therefore it is represented by a vector. Mass is a scalar that represents the quantity
of matter contained in an object. For mechanics, the primary relevant property is
that the higher the mass, the more difficult it is to move the object.
If enough force is applied to an object, in theory it would eventually start acceler-
ating. This idea is encapsulated by Newton's second law of motion:
F = m·a
Here, F is force, m is mass, and a is the acceleration. Because force is equal to
mass times acceleration, it's also true that acceleration is force divided by mass.
Given a force, this equation is what a game will use in order to calculate the accel-
eration.
Typically, we will want to represent the acceleration as a function over time, a ( t ).
Nowacceleration understandablyhasarelationshipbetweenvelocityandposition.
That relationship is that the derivative of the position function ( r ( t )) is the velocity
Search WWH ::




Custom Search