NWH Common
Search Results for

    Show / Hide Table of Contents

    Class Vehicle

    Base class for all NWH vehicles including VehiclePhysics2.VehicleController and DWP2.AdvancedShipController.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    Vehicle
    Namespace: NWH.Common.Vehicles
    Assembly: NWH.Common.dll
    Syntax
    [DisallowMultipleComponent]
    [RequireComponent(typeof(Rigidbody))]
    public abstract class Vehicle : MonoBehaviour

    Fields

    | Edit this page View Source

    ActiveVehicles

    Declaration
    public static List<Vehicle> ActiveVehicles
    Field Value
    Type Description
    List<Vehicle>
    | Edit this page View Source

    INPUT_DEADZONE

    Any input below this value will register as no input.

    Declaration
    public const float INPUT_DEADZONE = 0.02
    Field Value
    Type Description
    float
    | Edit this page View Source

    KINDA_SMALL_NUMBER

    Like SMALL_NUMBER but a bit bigger.

    Declaration
    public const float KINDA_SMALL_NUMBER = 0.01
    Field Value
    Type Description
    float
    | Edit this page View Source

    SMALL_NUMBER

    Anything below this can be considered 0.

    Declaration
    public const float SMALL_NUMBER = 1E-05
    Field Value
    Type Description
    float
    | Edit this page View Source

    SPEED_DEADZONE

    Any speed below this value will register as no speed.

    Declaration
    public const float SPEED_DEADZONE = 0.2
    Field Value
    Type Description
    float
    | Edit this page View Source

    isPlayerControllable

    True if the vehicle can be driven by the player. False if the vehicle is passive (such as a trailer). A vehicle that has isPlayerControllable can be the ActiveVehicle.

    Declaration
    public bool isPlayerControllable
    Field Value
    Type Description
    bool
    | Edit this page View Source

    onActiveVehicleChanged

    Called when active vehicle is changed. First parameter is the previously active vehicle and the second parameter is the currently active vehicle (at the time of the callback). Params can be null.

    Declaration
    public static UnityEvent<Vehicle, Vehicle> onActiveVehicleChanged
    Field Value
    Type Description
    UnityEvent<Vehicle, Vehicle>
    | Edit this page View Source

    onCameraEnterVehicle

    Called when the camera enters the vehicle.

    Declaration
    public UnityEvent onCameraEnterVehicle
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    onCameraExitVehicle

    Called when the camera exits the vehicle.

    Declaration
    public UnityEvent onCameraExitVehicle
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    onDisable

    Called when vehicle is put to sleep.

    Declaration
    [Tooltip("    Called when vehicle is put to sleep.")]
    [NonSerialized]
    public UnityEvent onDisable
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    onEnable

    Called when vehicle is woken up.

    Declaration
    [Tooltip("    Called when vehicle is woken up.")]
    [NonSerialized]
    public UnityEvent onEnable
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    onMultiplayerStatusChanged

    Invoked when MultiplayerIsRemote value gets changed. Is true if remote.

    Declaration
    public UnityEvent<bool> onMultiplayerStatusChanged
    Field Value
    Type Description
    UnityEvent<bool>
    | Edit this page View Source

    vehicleRigidbody

    Cached value of vehicle rigidbody.

    Declaration
    [Tooltip("    Cached value of vehicle rigidbody.")]
    [NonSerialized]
    public Rigidbody vehicleRigidbody
    Field Value
    Type Description
    Rigidbody
    | Edit this page View Source

    vehicleTransform

    Cached value of vehicle transform.

    Declaration
    [Tooltip("    Cached value of vehicle transform.")]
    [NonSerialized]
    public Transform vehicleTransform
    Field Value
    Type Description
    Transform

    Properties

    | Edit this page View Source

    ActiveVehicle

    Declaration
    public static Vehicle ActiveVehicle { get; }
    Property Value
    Type Description
    Vehicle
    | Edit this page View Source

    AngularVelocity

    Cached angular velocity of the vehicle.

    Declaration
    public Vector3 AngularVelocity { get; protected set; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    AngularVelocityMagnitude

    Cached angular velocity maginitude of the vehicle.

    Declaration
    public float AngularVelocityMagnitude { get; protected set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    CameraInsideVehicle

    True when camera is inside vehicle (cockpit, cabin, etc.). Set by the 'CameraInsideVehicle' component. Used for audio effects.

    Declaration
    public bool CameraInsideVehicle { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    LocalAcceleration

    Cached acceleration in local coordinates (z-forward)

    Declaration
    public Vector3 LocalAcceleration { get; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    LocalForwardAcceleration

    Cached acceleration in forward direction in local coordinates (z-forward).

    Declaration
    public float LocalForwardAcceleration { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    LocalForwardVelocity

    Cached velocity in forward direction in local coordinates (z-forward).

    Declaration
    public float LocalForwardVelocity { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    LocalVelocity

    Cached velocity in m/s in local coordinates.

    Declaration
    [ShowInTelemetry(NaN, NaN, null, null, 1)]
    public Vector3 LocalVelocity { get; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    MultiplayerIsRemote

    True if the vehicle is a client (remote) and not simulated. If true the input is expected to be synced through the network.

    Declaration
    public bool MultiplayerIsRemote { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Speed

    Cached speed of the vehicle in the forward direction. ALWAYS POSITIVE. For positive/negative version use SpeedSigned.

    Declaration
    [ShowInTelemetry(NaN, NaN, "0.0", "m/s", 1)]
    public float Speed { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    SpeedSigned

    Cached speed of the vehicle in the forward direction. Can be positive (forward) or negative (reverse). Equal to LocalForwardVelocity.

    Declaration
    [ShowInTelemetry(NaN, NaN, "0.0", "m/s", 1)]
    public float SpeedSigned { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    Velocity

    Cached velocity of the vehicle in world coordinates.

    Declaration
    public Vector3 Velocity { get; protected set; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    VelocityMagnitude

    Cached velocity magnitude of the vehicle in world coordinates.

    Declaration
    public float VelocityMagnitude { get; protected set; }
    Property Value
    Type Description
    float

    Methods

    | Edit this page View Source

    Awake()

    Declaration
    public virtual void Awake()
    | Edit this page View Source

    FixedUpdate()

    Declaration
    public virtual void FixedUpdate()
    | Edit this page View Source

    OnDisable()

    Declaration
    public virtual void OnDisable()
    | Edit this page View Source

    OnEnable()

    Declaration
    public virtual void OnEnable()
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics