"Sir" Issac Newton was a great guy. In life he was scared of girls and practiced alchemy like a paranoid squirrel. He was such a lovable nut. However, the sordid details of his personal life are often overshadowed by his observations about the motion of objects and the forces that affect them. He is long dead, but his laws of motion are a great help to physicists and game programmers.
The first of the these laws is the Law of Inertia, which, to put in a very blunt and non-technical way, states :
- Objects are lazy.
Go get a cup of coffee, or a RockStar energy drink, and think about this for a moment. While you are doing this, notice all the lazy objects around you. Then, come back.
You may have noticed that nothing moved — unless you moved it. This is half of the Law of Inertia. Surprisingly, the second part is that if an object is in motion, it will keep moving. Here's the Law of Inertia stated more properly :
- An object tend to stay still or keep moving in a straight line if no other forces act on them.
You may have heard that if you hit a golf ball in space that it will travel on forever. This is part of the Law of Inertia. The golf ball will not actually travel forever. It will travel until it finds a force capable of changing its motion. This could be the gravity of a star many billions of miles away, or it could possibly smash into an asteroid. But then, the pieces would travel until there is force to act on them.
Because we actually have to program forces in 2D physics, it's a perfect medium to illustrate this concept. Consider the code below :
x# = 400
y# = 300
xSpeed# = 0
ySpeed# = 0
SetFPS 60
Do
x# = x# + xSpeed#
y# = y# + ySpeed#
Cls 0
Print "xSpeed : " + str$(xSpeed#)
Print "ySpeed : " + str$(ySpeed#)
Circle x#, y#, 2, 1
Sync
Loop
Our ever present dot is completely still. We can tell this because both xSpeed# and ySpeed# are set to 0 it won't move on it's own. Because there are no forces to act on it, there is nothing to start it moving. It's going nowhere.
Now, consider this code :
x# = 400
y# = 300
xSpeed# = 0.2
ySpeed# = 0
SetFPS 60
Do
x# = x# + xSpeed#
y# = y# + ySpeed#
Cls 0
Print "xSpeed : " + str$(xSpeed#)
Print "ySpeed : " + str$(ySpeed#)
Circle x#, y#, 2, 1
Sync
Loop
It's the same exact code, except that I've set the initial xSpeed# to 0.2 subpixels. Because there is no force to act on it, it will travel on forever. It will also travel in a straight line. This is very important to understand. Unless it meets a force that can change it's direction it will continue to travel in a straight line.
Lastly, we finally get to talk about mass. The Law of Inertia, as it is related to mass, can be stated in this old chinese / japanese / hindu / african proverb :
- Fat men are harder to kidnap.
This is also the reason sumo wrestlers are so HUGE. The more mass an object has, the more inertia it has. Therefore it's harder to get it moving, harder to change it's direction, and harder to slow or stop it moving.
The math to calculate how much force is needed to move a certain amount of mass will be discussed in a future chapter.