Ship Controller
AdvancedShipController controls engines, rudders, bow and stern thrusters,
stabilization, and the anchor for a vessel that already has a working
Rigidbody and one or more WaterObject hulls.
Ship input
Add one ship input provider to the scene. The current ship-control names are:
SteeringThrottle,Throttle2,Throttle3, andThrottle4BowThrusterandSternThrusterSubmarineDepthEngineStartStopAnchorRotateSail
The Input System package is a declared dependency and the samples use
InputSystemShipInputProvider. Legacy Input Manager projects can instead use
InputManagerShipInputProvider with axes and buttons having the exact names
above.
Use these names exactly. For independent engine control, assign each
Engine.throttleBinding to Throttle, Throttle2, Throttle3, or
Throttle4.
Adding a ship
For a minimal test vessel, a capsule can be used in place of a finished hull.
- Create the hull GameObject and add a
Rigidbody. - Add
WaterObjectWizard, run Auto-Setup, and review the generatedWaterObjectsimulation mesh. See Quick Start for manual setup. - Add
AdvancedShipControllerto the same GameObject as the Rigidbody. Unity also adds its requiredAnchorcomponent. - Assign
referenceWaterObjectto the primary hull. If it is left empty,AdvancedShipController.Start()uses the first childWaterObjectit finds. - Configure the Rigidbody center of mass. A lower Y value usually improves roll stability, but placing it below the keel can make the vessel lean into turns. This uses the Rigidbody's own center-of-mass controls; no separate center-of-mass component is required.
- Add at least one engine and, when steering through water forces, a rudder.
- Add one input provider to the scene and enter Play mode.
The Ship tag is not required by AdvancedShipController. If the scene uses
NWH Common's optional VehicleChanger, add the ship to its vehicles list and
add a matching scene input provider.
Rudders

- Add a child transform for each rudder.
- Add an entry to
AdvancedShipController.rudders. - Assign its
rudderTransform, then configurelocalRotationAxis,maxAngle, androtationSpeed. - Add a
WaterObjectto the rudder mesh if it should generate the actual steering force. TheRudderentry rotates the transform; it does not apply a steering force by itself.
The current rudder input is ShipInputHandler.Steering.
Engines

Each entry in AdvancedShipController.engines is a propulsion system:
- Set
thrustPositionin the ship's local space and set a non-zerothrustDirection. - Set
maxThrust,maxSpeed, and the desiredthrottleBinding. - Optionally assign
propellerTransformand audio sources. - Enable
applyThrustWhenAboveWateronly when thrust should continue outside the water. Otherwise the controller applies thrust only while the thrust position is submerged.

Thrusters

Add entries to AdvancedShipController.thrusters, choose
BowThruster or SternThruster for thrusterPosition, and configure
position and maxThrust. The corresponding BowThruster or
SternThruster input controls the entry.
Engine sound

For each engine:
- Assign a looping source to
runningSource. - Optionally assign
startingSourceandstoppingSource. - Set
startDurationandstopDurationto match the useful part of their clips. - Tune
pitch,pitchRange,volume, andvolumeRange.
Optional cameras
Camera changing is provided by NWH Common rather than
AdvancedShipController. Add a child CameraChanger, make its cameras
children or populate its cameras list, and add a scene input provider if the
feature is needed.