<<PREVIOUS | TABLE OF CONTENTS | CONTINUE >>

## VERTICAL MOTION: LOOKING UP AND DOWN

It is possible to simulate the illusion of looking up and down, as well as flying and crouching on a ray-casting environment. However, note that -and this is important- the trick that is about to be explained in here does not always follow the correct three dimensional projection theories. **Ie: These are tricks, they’re not the correct way to do a “realistic” simulation.**

**A. Looking up and down.**

Recall that the projection plane is 200 units high. And up to this point, we always set the vertical center of the projection plane to be exactly in the middle (that is, at point y=100). Thus the midpoint of any wall slice will be drawn at projection point y=100. It turns out that the effect of looking up or down can be simulated simply by changing this value.

That is, to simulate **looking up**, instead of putting the center of the vertical slice at y=100, we put it at a point where y>100 (this is similar to moving the projection plane upward).

Similarly, to simulate **looking down**, instead of putting the center of the vertical slice at y=100, we put it at a point where y<100 (this is similar to moving the projection plane downward).

And why does this trick work at all? Hopefully, the following illustrations explains it.

If you’re confused, imagine holding a mirror with a wall behind you while standing straight. When the mirror is moved up or down, different part of the wall is shown. The mirror is the projection plane. (Take a moment to imagine this before continuing.)