O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mirror

In previous chapters, you learned how to create planes and terrains for your game. A great effect you can add to your terrains is the illusion that there is a reflection from the ground. This can be accomplished by using the mirror command. When you create a mirror, it reflects everything that is either above it or below it. The mirror command is very simple to add:

; This code creates a mirror
mirror=CreateMirror()

Here we’ve created a mirror called mirror, but you can call it anything you’d like. You can also reposition the mirror so that it is above or below your objects (see Figure 13.6).

Figure 13.6. Notice how the cone reflects in the mirror.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required