Game Development Reference
In-Depth Information
Finally I have added a rudder—a vertical control surface to regulate the yaw of the
aircraft. It has the following tensors:
0 . 10
0 . 4
A 1 =
0
0 . 10
00
0 . 5
0 . 10
0
A 0 =
0
0 . 10
00
0 . 5
0 . 10
. 4
A 1 =
0
0 . 10
00
0 . 5
The surfaces are added to the aircraft in a simple setup function, and the game
loop is exactly as we've seen it before. The user input notifies the software as it hap-
pens. (This is a function of the OpenGL system we are using to run the demos; in
some engines you may have to call a function to explicitly ask for input.) The input
directly controls the current values for each control surface.
The full code for the demo can be found on the CD.
11.2.2
AS AILING S IMULATOR
Boat racing is another genre that doesn't require hard constraints, at least in its sim-
plest form. If we want close racing with bumping boats, then we may need to add
more complex collision support. For our purpose we'll implement a simple sailing
simulator for a single player.
The aerodynamics of the sail is very similar to the aerodynamics we used for flight
simulation. We'll come back to the sail-specific setup in a moment, after looking at
the floating behavior of the boat.
Buoyancy
What needs revisiting at this point is our buoyancy model. In section 6.2.4 we created
a buoyancy force generator to act on a particle. We need to extend this to cope with
rigid bodies.
Recall that a submerged shape has a buoyancy that depends on the mass of the
water it displaces. If that mass of water is greater than the mass of the object, then
the net force will be upward and the object will float. The buoyancy force depends
only on the volume of the object that is submerged. We approximated this by treating
buoyancy like a spring: as the object is gradually submerged more, the force increases
until the object is considered to be completely under water, whereupon the force is
Search Nedrilad ::




Custom Search