Game Development Reference
In-Depth Information
But there is another way that is special for captious persons, a special formula that
can be written. All you need to do is choose the distance to the horizon in your game
scene (in the real world, this value is nearly equal to 5 kilometers, but you are most
likely to choose something in pixels). At this distance, objects have no apparent al-
teration, that is, a vanishing point. Then, using the normal speed of the main scene,
a right triangle can be constructed. It helps to calculate the speed of each layer, de-
pending on its distance from the horizon (this value should be defined by you manu-
ally). All you need to do is determine the angle between the hypotenuse and the ad-
jacent side using the arctangent function. Next, a simple trigonometric formula will
help you to figure out specific speed properties of any remote object.
To the effect of elements' speed, there is an interesting phenomenon: if you use
in the background a regular-designed continuous element, consisting of something
that looks like a geometric ornament with identical images, and whose speed is high
enough, you will see what is called the wagon-wheel effect .
Instead of moving from right to left, asit was intended, the element will begin to move
backward!Itisterrific!Why?Allthevariablesarecorrect!Itcandriveyoucrazy!Don't
worry, this is not the fault of the game engine, but only a result of a strong optical
illusion. Recall a fast-moving car that is shot on camera; in this case, it has rims with
spokes. The movement of the wheels looks very odd, that is, the rims and tires ro-
tate normally, but the spokes move backward. Coaches and wagons, whose wheels
rotate in the opposite direction, are even better illustrations of the illusion; several
movies depict this phenomenon, making us familiar with it. The illusion is based on
the fact that despite an element moving with the correct vector of speed, it suddenly
appears in the unpredictable positions on the screen. The following is a figure show-
ing the wagon-wheel effect:
As you can see, there is a row of identical utility poles in the background, but for de-
scriptive reasons, I marked odd poles with a dot. If the row moves at a slow speed,
total time is normal: each pole successively passes the grid, drawing a trajectory
with phases that stay pretty tight. What if the speed is wrong, that is, it is higher than
the specified threshold? As you can see, the distance between phases is increased,
Search WWH ::




Custom Search