Create an Interactive boat simulation

You can create an interactive motor boat simulation by combining an ocean, a motor boat, and some hotkeys to drive the boat.

  1. Select Fluids > Ocean > .
  2. In the Create Ocean window, turn on Attach to Camera and Create Preview Plane, and then click Create Ocean.
  3. Select the boat geometry.
  4. Select Fluids > Create Boat > Make Motor Boat.

    Maya attaches a locator to the boat with built-in expressions to simulate buoyancy effects.

  5. Select the perspective camera (persp) and select Edit > Group. This creates a group and puts the perspective camera in it.
  6. In the Connection Editor(Windows > General Editors > Connection Editor), do the following:
    • Connect the boat locator (created in step #4) Translate x and Translate z attributes to the transform (ocean height field) Translate x and Translate z attributes respectively.
    • Connect the locator Translate x and Translate z attributes to the camera group (created in step #5) Translate x and Translate z attributes.

      This connects the movement of the boat along the ocean plane to the ocean and to the movement of the camera.

  7. Select the boat locator and in the Attribute Editor open the Extra Attributes section.
  8. Switch to shaded mode.
  9. Playback the scene and adjust the throttle and rudder settings.

To speed up the simulation, you can make the Wave Turbulence zero on the ocean shader and instead increase Num Frequencies. Increasing the Wave Height also makes the simulation more dramatic.

Hotkeys

Create hotkeys for the following commands and use them to drive the boat.

Stop Boat Key

setAttr locator1.throttle 0 setAttr locator1.rudder 0

Increase Throttle

float $t = `getAttr locator1.throttle`; setAttr locator1.throttle ($t + 0.5);

Decrease Throttle

float $t = `getAttr locator1.throttle`; $t -= 0.5; if( $t < 0 ) $t = 0.0; setAttr locator1.throttle $t;

rudder Left

float $t = `getAttr locator1.rudder`; $t += 2.0; if( $t > 20 ) $t = 20; setAttr locator1.rudder $t;

rudder Right

float $t = `getAttr locator1.rudder`; $t -= 2.0; if( $t < -20 ) $t = -20; setAttr locator1.rudder $t;