Game Development Reference
In-Depth Information
Unfortunately, the actual calculation for real gravity would be a little more
complex than taking away one as the effect of earth's gravity is a downward
acceleration of 9.8 meters per second. 2 This means the downward speed of
an object gets faster by 9.8 meters per second with each second. An object
starting with a speed of 0 after 1 second will be moving at 9.8 meters per
second, after 2 seconds it will be moving at 19.6 meters per second,
and after 3 seconds it will be moving at 29.4 meters per second.
In addition, a game loop may not take exactly 1 second to execute. This will
throw out any calculations you attempt with each loop update on a second by
second basis.
Fortunately, game engines take care of all the mathematics and allow you to set
just one gravity value for your environment. Let's take a look at how Unity does it.
Unity Specifics
From the main menu, select Edit > Project Settings > Physics. The Physics
properties will open in the Inspector as shown in Figure 2.27 . The default
setting is for a downward acceleration of 9.81 meters per second. 3
Fig 2.27 Unity's Physics properties.
2 Earth's actual gravitational acceleration.
3 This is acceleration due to gravity on earth.
Search Nedrilad ::

Custom Search