Implementing simple plane controls
As with the previous recipe for car physics, this recipe is all about enough simulation to make the player feel involved (and hopefully enjoy themselves), but not so much as to either trip the player up in unnecessary detail or slow the game down to a crawl under the possibly heavy weight of a more rigorous simulation.
There is no stalling, wind shear, or trim adjustments here. Just the player turning left, right, up, or down, and powering towards fun.
Getting ready
This recipe relies upon the GeometricBuffer
classes covered in Chapter 3, Procedural Modeling, to construct the plane, but any method of creating or supplying a 3D mesh should be sufficient.
How to do it...
To begin flying your own plane:
1. Begin a new
Plane()
class with instance-level variables to hold the rendering details:class Plane { GeometricBuffer<VertexPositionNormalTexture> buffer; BasicEffect effect;
2. Add a constructor and map out the key locations for creating the plane's mesh...