Game Development Reference
In-Depth Information
F IGURE 11.3
Screenshot of the sailboat demo.
the hull. The lift raises the boat out of the water (whereupon there is no buoyancy
force, of course, but no drag from the hull either), and only the hydrofoils remain
The hydrofoils can be easily implemented as modified surface force generators.
The modification needs to make sure that the boat doesn't start flying: it generates no
lift once the foil has left the water. In practice a hydrofoil is often designed to produce
less lift the higher the boat is out of the water so that the boat rapidly reaches its
optimum cruising height. This behavior also wouldn't be difficult to implement; it
requires only scaling back the tensor-generated force based on how near the hydrofoil
is to the surface of the water.
The Sailing Example
The sailboat demo on the CD puts all these bits together. You can control a catama-
ran on a calm ocean. The orientations of the sail and rudder are the only adjustments
you can make. The prevailing wind direction and strength are indicated, as you can
see from the screenshot in figure 11.3.
The boat is set up with four buoyancy force generators, a sail, and a rudder. The
wind direction changes slowly but randomly over time. It is updated at each frame
with a simple recency-weighted random function.
The update of the boat is exactly the same as for the aircraft demo, and user input
is also handled as before (see the code on the CD for a complete listing).
In this chapter we've met a set of real game examples where our physics engine com-
bines with real-world physics knowledge to produce a believable simulation. In the
Search Nedrilad ::

Custom Search