Class 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.
Inherited Members
Namespace: NWH.DWP2.ShipController
Assembly: NWH.DWP2.dll
Syntax
[RequireComponent(typeof(Anchor))]
[Serializable]
[DefaultExecutionOrder(90)]
public class AdvancedShipController : Vehicle
Fields
| Edit this page View SourcedropAnchorWhenInactive
Should the anchor be dropped when the ship is deactivated?
Declaration
[Tooltip("Should the anchor be dropped when the ship is deactivated?")]
public bool dropAnchorWhenInactive
Field Value
| Type | Description |
|---|---|
| bool |
engines
Ship's engines.
Declaration
[Tooltip("List of engines. Each engine is a propulsion system in itself consisting of the engine and the propeller.")]
[SerializeField]
public List<Engine> engines
Field Value
| Type | Description |
|---|---|
| List<Engine> |
input
Class that handles all of the user input.
Declaration
[SerializeField]
[Tooltip("Class that handles all of the user input.")]
public ShipInputHandler input
Field Value
| Type | Description |
|---|---|
| ShipInputHandler |
maxStabilizationTorqueAngle
Angle at which roll stabilization torque reaches maximum.
Declaration
[Tooltip("Angle at which roll stabilization torque reaches maximum.")]
public float maxStabilizationTorqueAngle
Field Value
| Type | Description |
|---|---|
| float |
onShipInitialized
Called after ship initialization.
Declaration
[Tooltip("Called after ship initialization.")]
public UnityEvent onShipInitialized
Field Value
| Type | Description |
|---|---|
| UnityEvent |
pitchStabilizationMaxTorque
Torque that will be applied to stabilize pitch when the ship pitch angle reaches maxStabilizationTorqueAngle.
Declaration
[Tooltip("Torque that will be applied to stabilize pitch when the ship pitch angle reaches maxStabilizationTorqueAngle.")]
public float pitchStabilizationMaxTorque
Field Value
| Type | Description |
|---|---|
| float |
referenceWaterObject
Declaration
[FormerlySerializedAs("ReferenceWaterObject")]
public WaterObject referenceWaterObject
Field Value
| Type | Description |
|---|---|
| WaterObject |
rollStabilizationMaxTorque
Torque that will be applied to stabilize roll when the ship roll angle reaches maxStabilizationTorqueAngle.
Declaration
[Tooltip("Torque that will be applied to stabilize roll when the ship roll angle reaches maxStabilizationTorqueAngle.")]
public float rollStabilizationMaxTorque
Field Value
| Type | Description |
|---|---|
| float |
rudders
Ship's rudders.
Declaration
[SerializeField]
[Tooltip("Ship's rudders.")]
public List<Rudder> rudders
Field Value
| Type | Description |
|---|---|
| List<Rudder> |
stabilizePitch
Should the ship pitch be stabilized?
Declaration
[Tooltip("Should the ship pitch be stabilized?")]
public bool stabilizePitch
Field Value
| Type | Description |
|---|---|
| bool |
stabilizeRoll
Should the ship roll be stabilized?
Declaration
[Tooltip("Should the ship roll be stabilized?")]
public bool stabilizeRoll
Field Value
| Type | Description |
|---|---|
| bool |
thrusters
Bow or stern thrusters that a ship has.
Declaration
[SerializeField]
[Tooltip("Bow or stern thrusters that a ship has.")]
public List<Thruster> thrusters
Field Value
| Type | Description |
|---|---|
| List<Thruster> |
weighAnchorWhenActive
Should the anchor be weighed/lifted when the ship is activated?
Declaration
[Tooltip("Should the anchor be weighed/lifted when the ship is activated?")]
public bool weighAnchorWhenActive
Field Value
| Type | Description |
|---|---|
| bool |
Properties
| Edit this page View SourceAnchor
Anchor script.
Declaration
public Anchor Anchor { get; }
Property Value
| Type | Description |
|---|---|
| Anchor |
SpeedKnots
Speed in knots.
Declaration
public float SpeedKnots { get; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceFixedUpdate()
Declaration
public override void FixedUpdate()
Overrides
| Edit this page View SourceGetPitchAngle()
Returns pitch angle of the ship in degrees. Positive values indicate bow up, negative values indicate bow down.
Declaration
public float GetPitchAngle()
Returns
| Type | Description |
|---|---|
| float | Pitch angle in degrees. |
GetRollAngle()
Returns roll angle of the ship in degrees. Positive values indicate starboard side down, negative values indicate port side down.
Declaration
public float GetRollAngle()
Returns
| Type | Description |
|---|---|
| float | Roll angle in degrees. |
OnDisable()
Declaration
public override void OnDisable()
Overrides
| Edit this page View SourceOnEnable()
Declaration
public override void OnEnable()
Overrides
| Edit this page View SourceStart()
Declaration
public void Start()
Update()
Declaration
public void Update()