Game Development Reference
In-Depth Information
2.5 The Laws of Physics
Game players bring their own experience of the real world to a game environment.
They understand that gravity makes things drop, acceleration changes the
speed of an object, and when an object hits another object a reaction, such
as bouncing or exploding, will occur based on the object's composition.
These expectations within game environments are essential to establishing
the player's suspension of disbelief —a psychological state in which a player
accepts the limitations of a medium in order to engage with the content. This
can include anything from low-quality graphics to flying aliens. Anything that
messes with the player's suspension of disbelief causes them to disengage
and lose interest, such as being woken from a dream. A big part of ensuring a
game environment is making the virtual world act and react like the real one.
The laws of physics are a set of complex rules that describe the physical nature
of the universe. Adhering to these rules when creating a game is key to creating
a believable environment in which the player interacts. Sometimes the laws
are bent to suit narrative; however, they essentially remain static throughout.
For example, players in a modern warfare game, taking place on earth, would
expect gravity to react for their character as it does for them in the real world. In
the case of science fiction, the effects of gravity may be altered to fit the story.
Physics is a fundamental element in games as it controls the way in which
objects interact with the environment and how they move.
Although physics covers topics such as Einstein's theory of relativity and
thermodynamics, the key ones used in game environments are Newton's
three laws of motion and the law of gravity.
2.5.1 The Law of Gravity
Although it is a myth that an apple fell on Newton's head, he did devise
his theory of gravity while watching an apple fall from a tree. In Newton's
publication the Principia , the force of gravity is defined thus:
Every particle of matter in the universe attracts every other particle with a
force that is directly proportional to the product of the masses of the particles
and inversely proportional to the square of the distance between them.
In short, this means the bigger an object, the more it attracts other objects
and that this attraction gets stronger the closer it is. Kepler also used this law,
a century later, to develop his laws of planetary motion.
In game environments, applying a downward velocity to an object simulates
gravity. The y coordinate of the object's position is updated with each game
loop to make it move in a downward direction. If you were to code this in
Unity, the JavaScript would look something like this:
= −
transform.position.y transform.position.y 1;
(2.4)
Search Nedrilad ::




Custom Search