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

Gravity

The concept of gravity is important to many different types of games. Unless your game takes place in space or in some alternate gravity-less universe, you’ll probably want your players or objects to either stay on the ground or float back to the ground when they jump in the air. There are several ways to create the illusion of gravity, and we’ll explore one of the easiest in the following example.

Start by opening the program demo13-01.bb, which includes several features that have already been covered in the book. We have a sky, created by a sphere; a terrain with a collision set up between our character (a sphere with a pattern) so that he doesn’t fall through the terrain; and controls set up to move around. Run the program and use ...

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