Namespace NWH.DWP2.ShipController
Classes
AdvancedShipController
Main controller for ships, boats and other water vessels. Manages propulsion through engines and propellers, steering via rudders, and additional control through bow/stern thrusters. Includes stabilization systems, anchor functionality, and multiplayer support. Can be used for everything from small boats to large ships.
Anchor
Approximates the behavior of a real anchor by keeping the object near the anchored position, but allowing for some movement.
Engine
Represents a ship engine and propeller system that generates thrust. Simulates RPM-based thrust generation with start/stop sequences and sound effects. Includes propeller efficiency modeling through thrust curves and support for reverse thrust. Multiple engines can be used per ship for differential thrust control.
InputManagerShipInputProvider
Ship input provider for Unity's legacy Input Manager. Handles keyboard and gamepad input through Input.GetAxis and Input.GetButton. Requires proper axis and button setup in Project Settings > Input Manager. Falls back to hardcoded keys if input bindings are not configured.
InputSystemShipInputProvider
Ship input provider for Unity's new Input System. Uses ShipInputActions asset for input binding configuration. Supports keyboard, gamepad, and custom input devices through the Input System. Input bindings can be modified by editing the ShipInputActions asset.
MobileShipInputProvider
Ship input provider for mobile devices using on-screen UI controls. Reads input from Unity UI Sliders and MobileInputButtons placed in the scene. All control assignments are optional - assign only the controls you need for your ship.
Rudder
Represents a ship rudder that rotates based on steering input. Provides visual rotation only - actual steering forces are applied by WaterObject components on the rudder itself. Multiple rudders can be used on a single ship.
ShipInputActions
Provides programmatic access to UnityEngine.InputSystem.InputActionAsset, UnityEngine.InputSystem.InputActionMap, UnityEngine.InputSystem.InputAction and UnityEngine.InputSystem.InputControlScheme instances defined in asset "Packages/com.nwh.dynamicwaterphysics/Runtime/ShipController/Input/InputProviders/InputSystemProvider/ShipInputActions.inputactions".
ShipInputHandler
Manages ship input by retrieving values from active ShipInputProviders and storing them in ShipInputStates. Automatically polls all registered input providers and combines their inputs. Can be disabled for manual input control via scripting or AI.
ShipInputProvider
Base class for all ship input providers. Inherit from this to create custom input systems for ship controls. Provides virtual methods for all ship control inputs including throttle, steering, thrusters, and submarine depth control.
Sink
Simulates a ship taking on water and sinking by gradually increasing mass over time. Works with VariableCenterOfMass component to affect buoyancy and cause the ship to sink. Can be triggered to simulate hull breaches or flooding.
Submarine
Enables submarine functionality by controlling ballast mass for diving and surfacing. Manages depth control through variable mass and can automatically maintain horizontal orientation. Adjusts Rigidbody mass and center of mass directly for depth changes.
Thruster
Lateral thruster for sideways ship movement. Bow thrusters are mounted at the front for tight turning and docking, stern thrusters at the rear. Multiple thrusters of each type can be added for increased lateral control.
Structs
ShipInputActions.ShipControlsActions
Provides access to input actions defined in input action map "ShipControls".
ShipInputStates
Container for all ship input states. Stores current values for all ship controls including throttle, steering, thrusters, and special inputs.
Interfaces
ShipInputActions.IShipControlsActions
Interface to implement callback methods for all input action callbacks associated with input actions defined by "ShipControls" which allows adding and removing callbacks.
Enums
Engine.RotationDirection
Visual rotation direction of the propeller.
Engine.State
Current operational state of the engine.
Engine.ThrottleBinding
Which throttle input channel this engine responds to. Allows independent control of multiple engines on the same ship.
Thruster.RotationDirection
Visual rotation direction of the thruster propeller.
Thruster.ThrusterPosition
Position of the thruster on the ship. Determines which input controls it and the direction of thrust application.