Game Development Reference
In-Depth Information
How it works
The above physics properties are used in the following ways:
•
Time
: In games often we have to evaluate the time required for the player to reach
a object with a given speed. In such cases, we use the Pythagorean theorem to
evaluate the distance between the object and the player, then we will use the
Time
= Distance/Speed
formula to evaluate the time that the player will need to cover a
certain distance with a given speed.
•
Distance
: Similarly, to evaluate the distance between the player and the object, we
can use the
Distance = Speed * Time
formula to evaluate the distance between the
object and the player, considering the speed and time as known factors.
•
Mass
: This is a property that is frequently used while dealing with the physics en-
gine. Whenever we want to demonstrate both the objects with different behavior in
terms of movement, we can change their mass property. Consider a situation in
which we want to have two physics objects such as bullet and a ball. In this case,
the mass of the bullet will be very low as compared to the ball, so as to make the
bullet travel with a high speed, even with a very little applied force or impulse.
•
Velocity
: Whenever we apply any force to any physics body by using a vector, we
are changing the velocity of the object by providing the magnitude and the direc-
tion to the physics object.