O'Reilly logo

Microsoft XNA 4.0 Game Development Cookbook by Luke Drumm

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

Applying simple car physics

In this example, we're going to tackle what I consider to be pretty close to the bare minimum of car physics: allowing the player to move forwards, backwards, left and right. No simulation of note will be included beyond the tracking of speed and location.

This sort of physics is usually well-suited for the simple, arcade type driving where you want the player to be able to focus on aspects other than the act of driving itself, such as dodging or shooting.

Getting ready

This recipe relies upon the Geometric Buffer classes discussed in Chapter 3, Procedural Modeling, to build the car mesh. Any representation, be it a 3D mesh or even a 2D image, can be substituted without issue though.

How to do it...

To create your own ...

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