### Car physics - part 1

From this article I begin a series of articles dedicated to the physics of a car. The information provided here can be used in simple car simulators. I am not trying to create a full featured physics engine that can simulate the car completely but give you an idea of how things work. However the small physics engine we will build will be sufficient enough for small games and demos.

#### Conventions

In order to study and simulate physics we will be using vector mathematics. 3D vectors will be used with (y) pointing UP. Our vehicle will be moving on the X-Z plane. All the physical properties will be in SI units (meters, kilograms, radians, Newtons etc.).

#### Introduction to Physics

The forces acting on a car, or any object in general, can be divided into two major categories. Longitudinal forces operating in the direction of the body and, lateral forces acting sideways and perpendicular to the direction of the body. Longitudinal is the force on the wheels either accelerating or braking, the rolling friction of the tyres and aerodynamic drag. These forces determine the acceleration and the speed of the car. Lateral forces are generated by sideways friction of the tyres and generate angular momentum and torque causing the car to rotate around a vertical axis and finally change direction. We can focus on each of these categories separately to simplify our study. The final result in the moving state of the car and its position is the sum of all.

#### Moving in a straight line

Let's consider of a car moving in a straight line. No lateral forces are acting upon it. We only have to think about acceleration caused by the engine, braking from the brakes, resistance caused by the aerodynamic drag and rolling friction of the wheels. The only positive (accelerating) force is that caused by the engine and the drive wheels. All the others are considered negative (decelerating).

The accelerating force is the same in magnitude to the force generated by the engine torque on the wheels and has the direction of the move. For the time being we will call this force EngineForce. Later we will analyze it further.

**F**a = **u** * EngineForce

where **u** is a unit vector pointing to the
direction of the move.

The resisting forces are small in magnitude and rather insignificant in small speeds. As the car accelerates though the start to play an important role in setting the speed limit at which the car can move. It's the balance between the traction force and the resistance that keeps the car at a constant speed. If either of the two is greater in magnitude the car either accelerates or decelerates.

The first resisting force we come across is
aerodynamic drag. You can feel it if you extend your hand out of
the window of a car when it is moving. The higher the speed the
stronger the drag. You should also notice the difference in the
drag as you move your hand and change the angle at which the
wind hits it. All these can be put together and be calculated to
get the magnitude of the drag. First we start with the shape and
size of the car. This is described by a coefficient called the
drag coefficient (**C**d). The aerodynamic drag is
proportional to the square of the velocity. This explains why it
gets so important as the speed increases.

**F**d = - **C**d * **v**
* |**v**|

The drag coefficient (**C**d) is constant and
describes the shape and the size of the car. **v**
is the velocity vector and |**v**| is its magnitude
or as we usually call it the speed. The velocity is a vector and
has a direction while speed is a scalar value. The minus (-) in
before the (**C**d) means that the drag is opposed
to the velocity vector.

The speed is magnitude of the velocity hence it is the square root of the sum of its coordinates squared. Confused in mathematical terms? Don't be here is the code to calculate the speed

s = sqrt(v.x*v.x + v.y*v.y + v.z*v.z);

Then there is the rolling resistance. This is caused by all the moving parts of the vehicle that interfere with the movement. Wheels rolling on the ground, axles rotating, transmission shafts you name it it's there. This is proportional to the velocity.

**F**r = -** C**r * **v**

**C**r is the rolling resistance coefficient and
usually it is 30 (thirty) times bigger than the aerodynamic drag
coefficient. This means that at around 30 m/s the two drags are
almost of the same magnitude. From that point on the aerodynamic
drag becomes the most significant resistance in the movement of
the car.

The resulting force that actually moves the car is calculated by the formula

**F**t = **F**a + **F**d
+ **F**r

The acceleration of the car is given by the Newton's law

**a** = **F**t / **m**

where **m** is the mass of the car in kilograms.

By integrating the acceleration over time we obtain the velocity of the vehicle

**v** = **v** + dt * **a**

continuing the integration path leads to the car's position

**p** = **p** + dt * **v**

All these provide enough accuracy in the calculation of the acceleration and top speed of a car. If we apply everything correctly there is no need to impose any limits. They are set by the laws of physics.

#### Constants

So far we introduced two constants **C**d and
**C**r. Let's take a closer look at them starting
with **C**d. In fluid mechanics we find that the
aerodynamic drag is

**F**d = 0.5* **C**x * **A**
* **rho** * **v** ^{2}

Where **C**x is a coefficient of friction and
describes the shape of the car, **A** is the
frontal area and **rho** is the density of the air.
Hence the drag coefficient that we
initially used is

**C**d = 0.5* **C**x * **A**
* **rho**

and for an ordinary car is approximately **C**d =
0.43.

We have determined by tests that the rolling coefficient is
30 times as much so **C**r = 12.9