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

Rotating Objects

Rotating your objects is similar to moving them in that you need to define which keys you want to use to rotate your objects and on which axis you’d like to rotate them. The axis for the rotation will determine how your objects will spin. Rotation can occur along the x axis, the y axis, or the z axis (see Figures 6.2, 6.3, and 6.4).

Figure 6.2. Rotation along the x axis.

Figure 6.3. Rotation along the y axis.

Figure 6.4. Rotation along the z axis.

Using the same program as above, let’s add the following code above the ...

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