Even in the simple game Asteroids from Atari, the use of force and motion are key elements of the game design. When the THRUST button is pressed, the player’s ship accelerated in the direction the ship is pointed. This may be very different to the direction of the ship's velocity.

# Learning Objectives

- Explain each of Newton’s three laws of universal motion.
- Use Newton’s 2nd Law to calculate the net force and acceleration on an object.
- Model the motion of an object using the Forward Euler Method given the forces on an object.

# Introduction

In 1687, Sir Isaac Newton published his famous book, the Principia. In this book, he introduced his three laws of universal motion. These three laws are the fundamental rules by which all things get from one place to another. They describe situations as simple as why you feel pushed back into your seat when you accelerate at a green light, to events as vast as the movements of all the galaxies the universe. These three laws are as follows:

**Newton’s First Law**: An object at rest will tend to remain at rest, and an object in motion will tend to remain in motion at a constant velocity unless acted upon by an outside force. The strength of this tendency is described as the object’s inertia.

**Newton’s Second Law**: The net force on an object is the product of the object’s mass and its acceleration. Mass is a measure of an object’s inertia. Mathematically,

**Newton's Third Law**:For every action there exists an equal in magnitude but oppositely directed reaction.

Using these three laws of motion, one can model the motion of nearly everything in the entire universe from subatomic particles like an electron, to entire galaxies. In a game world, all motion will be dependent upon what forces are set up. Even in the simple game of Asteroids, Newton’s Laws are used with great effect. The thruster for the player craft exerts a force on the craft, and that force causes an acceleration and a change in the direction and speed of the craft. Certainly this is a simple example, but ultimately all modeling of motion comes down to determining the net force on an object so the acceleration can be found. With the acceleration, one can then use the Forward Euler Method to model the changing velocity and position of in-game objects.

There are some basic forces that one will encounter often. Certainly there are many more types of forces than we'll investigate within the scope of this course, but here is a list of some of the forces that will be used most commonly.

**Applied forces**: An applied force will typically have a constant value and can be pointed in any direction.

**Weight**: The weight, the force of gravity, will be constant and will always point downward. The weight is found by multiplying the mass of the object by the acceleration due to gravity,

**Normal Forces**: A normal force is the force a surface exerts on an object. The direction of this force is always perpendicular to the plane of the surface.

**Friction**: Friction is the force between two surfaces that opposes motion and its magnitude is proportional to the normal force. The direction of the frictional force is always opposite of the velocity.

Here $\mu$ is the coefficient of friction which depends upon the nature of the two surfaces, *N* is the normal force, and $\hat{v}$ simply indicates the direction of the object’s velocity.

**Rope Tension**: Tension forces are always pulling forces. The force exerted by a rope is always away from the object, never towards.

**Wind Resistance**: Lastly, there is wind resistance. Wind resistance is like a frictional force in that it opposes motion and is always in the opposite direction as the object’s velocity. Unlike friction, the magnitude of the wind resistance force is proportional to the velocity.

Here *c* is a coefficient which depends upon the fluid and the shape of the object. This formula for wind resistance can easily be used for the resisting force through any fluid such as water. Equation 4 is actually a rough approximation. At very high speeds, the drag force can depend heavily upon v^{2} or even v^{3}. For a true simulator, this is important, but for most game play, Equation 4 is sufficient for producing realistic motion.

In order to model the motion of an object, the net force on the object must be determined. With a coordinate system already in place, your forces will have specific x, y, and z components. First determine the sum of all the forces in each of the three directions.

(5)Once you have the net force vector, use Newton’s 2^{nd} Law to find the acceleration,

Be mindful that floating-point division is far more computationally costly than multiplication. With this in mind, it is more efficient to define a new variable to hold the value of the recipricol of the mass, $1 / m$ and find the acceleration by multiplying the net force by the recipricol of the mass. It means requiring a bit more memory, but it eliminates a lot of additional processor instructions.

Now that we know how to calculate the acceleration vector, one can use the Velocity Verlet Method to determine the new velocity, $\vec {v}$, and new position, $\vec {r}$.

(7)# Laboratory Procedures

- Write a program that models the motion of a box sliding across a floor. Ask the user to provide an initial speed and coefficient of friction, and use the Velocity Verlet Method with $\Delta t = 0.10 s$ to determine the distance the box travels before coming to a stop. When checking for when the box is stopped, keep in mind that the calculated velocity will not likely ever be exactly zero. Your check should for a velocity less than some minimum value. Have your instructor check the execution of your code.
- Write a program that simulates the path of a model rocket given the following parameters:
- the rocket begins at the position (0, 0, 0.2 m),
- the rocket has a mass of 0.0742 kg,
- the coefficient for wind resistance is 0.02,
- the rocket motor provides a thrust of 10.0 N for 1.00 seconds at a heading of 23 degrees and a pitch of 62 degrees,
- Use a time-step of 0.1 s.

- Have your program output the position vector and elapsed time for the rocket when it returns to the ground. Have your instructor check the execution of your code.

# Postlab Questions

- The problem of identifying a zero velocity in the program for Procedure one is important. Handling the problem correctly gives you a realistic behavior for the box. Describe how the model would proceed if a check for zero velocity is not done. Be careful here, the answer is not obvious.
- Surface friction and wind resistance are both forces that oppose motion and are in the $- \hat{v}$ direction. Explain how these two forces are different from each other.
- In the model rocket program, no mention was made of the wind speed. Explain how one would incorporate the wind speed into the overall solution for the motion of the rocket. Keep in mind that the wind speed will have a velocity vector independent of the velocity vector of the rocket.