NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Dashboard and GUI

    DashGUIController is a script to help with setting up vehicle dashboards or game GUI. It reads the selected vehicle and updates the gauges and indicator lights on a Canvas.

    Add it to the dashboard Canvas, then assign the gauges and lights in its inspector. Enable the corresponding options for the displays you want to use. An included dashboard prefab is a useful starting point.

    Choosing the vehicle

    DashGUIController inspector.

    DashGUIController inspector.

    • It accepts AnalogGauges, DigitalGauges and DashLights.
    • If Data Source is Vehicle Changer make sure that you have one Vehicle Changer present in the scene. Vehicle Changer as a source should be used for game GUI while Vehicle Controller should be used for in-vehicle dash GUI.

    For a dedicated dashboard, choose Vehicle Controller and assign that vehicle. With Vehicle Changer, the GUI follows the active vehicle as the player switches. The built-in speed display uses km/h.

    Analog gauges

    AnalogGauge inspector.

    AnalogGauge inspector.

    Default analog gauge.

    Default analog gauge.

    AnalogGauge is a universal analog gauge script that can be used for constructing vehicle dashboards or game UI.

    It expects to have a Needle GameObject as a child object of the script.

    Prefab of a pre-configured analog gauge is included with the asset.

    LockAtStart and LockAtEnd can be used to peg the needle at the Start Angle or End Angle for easier configuration. Both options only work in play mode.

    Set Max Value to the full-scale reading, then use Start Angle and End Angle to align the needle with the dial. Needle Smoothing adds lag to its movement.

    Digital gauges

    DigitalGauge inspector with textual option selected.

    DigitalGauge inspector with textual option selected.

    DigitalGauge inspector with numerical option selected.

    DigitalGauge inspector with numerical option selected.

    Simple DigitalGauge example.

    Simple DigitalGauge example.

    DigitalGauge is used to display textual/numerical values on the vehicle dashboard or game GUI.

    It requires a child named Readout with a Unity UI Text component. A separate title label can be added if wanted.

    Line Image object is required if Show Progress Bar option is used in which case the image will be scaled to imitate the progress bar.

    Unit

    If Unit field is populated the unit will be displayed inside the Readout, after the value.

    Textual Type

    When Textual is selected as Gauge Type the provided String value will be displayed in the Readout object with no further formatting.

    Numerical Type

    • A formatted value of Numerical Value field will be shown.

    • Format can be defined in the Format field as it would be used in float.ToString() function. For example, 0.00 displays two decimal places, while 0 displays a whole number.

    • Numerical Smoothing smooths the value for easier readout.

    Dashboard lights

    DashLight inspector.

    DashLight inspector.

    Example DashLight.

    Example DashLight.

    A simple script that switches Color of an Image between On Color and Off Color, usually white and black.

    • Color of the Image when the light is on.
    • Color of the Image when the light is off.
    • Fade Time - time it takes for the light to turn off, once Hold Time expires. Imitates dash lights that use conventional bulbs.
    • Hold Time - time it takes for the light to start turning off after the state has changed. Useful to remove flicker from signals that are not persistent but rather change on frame-to-frame basis, e.g. ABS and TCS.
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics