NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class AnalogGauge

    Analog gauge that rotates a needle GameObject to display a value, similar to real-world speedometers and tachometers. Requires a child GameObject named "Needle" to function properly.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    AnalogGauge
    Namespace: NWH.VehiclePhysics2.VehicleGUI
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    public class AnalogGauge : MonoBehaviour

    Fields

    endAngle

    Angle of the needle (in degrees, Z-axis rotation) at the maximum value. Use lockAtEnd in play mode to visually position and determine the correct angle.

    Declaration
    [Tooltip("angle of the needle at the highest value. You can use lock at end option to adjust this value while in play mode.")]
    public float endAngle
    Field Value
    Type Description
    float

    lockAtEnd

    Locks the needle position at endAngle for calibration purposes (play mode only). Useful for determining the correct end angle value for your gauge design.

    Declaration
    [Tooltip("Locks the needle position at the end angle (play mode only).")]
    public bool lockAtEnd
    Field Value
    Type Description
    bool

    lockAtStart

    Locks the needle position at startAngle for calibration purposes (play mode only). Useful for determining the correct start angle value for your gauge design.

    Declaration
    [Tooltip("Locks the needle position at the start angle (play mode only).")]
    public bool lockAtStart
    Field Value
    Type Description
    bool

    maxValue

    Maximum value that the gauge can display. Values above this will be clamped. For speedometers, this represents the highest speed on the gauge face (e.g., 240 for a 240 km/h gauge). For tachometers, this represents the maximum RPM (e.g., 8000).

    Declaration
    [Tooltip("Value at the end of needle travel, at the end angle.")]
    public float maxValue
    Field Value
    Type Description
    float

    needleSmoothing

    Smoothing factor applied to needle movement. Higher values create more inertia and damping. 0 = instant response, 1 = maximum smoothing (simulates physical needle with mass). Recommended: 0.3-0.7 for realistic analog gauge behavior.

    Declaration
    [Range(0, 1)]
    [Tooltip("    Smooths the travel of the needle making it more inert, as if actually had some mass and resistance.")]
    public float needleSmoothing
    Field Value
    Type Description
    float

    startAngle

    Angle of the needle (in degrees, Z-axis rotation) at the minimum value (typically zero). Use lockAtStart in play mode to visually position and determine the correct angle.

    Declaration
    [Tooltip("angle of the needle at the lowest value. You can use lock at start option to adjust this value while in play mode.")]
    public float startAngle
    Field Value
    Type Description
    float

    Properties

    Value

    Gets or sets the current value displayed by the gauge. Values are automatically clamped between 0 and maxValue.

    Declaration
    public float Value { get; set; }
    Property Value
    Type Description
    float
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics