NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class VehicleLight

    Represents a single vehicle light that can contain multiple LightSource implementations.

    Inheritance
    object
    VehicleLight
    Namespace: NWH.VehiclePhysics2.Effects
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    public class VehicleLight
    Remarks

    One headlight is usually several sources: a Spot Light for the beam plus an emissive mesh for the lens. Every source in a VehicleLight switches together.

    Fields

    isOn

    Declaration
    protected bool isOn
    Field Value
    Type Description
    bool

    lightSources

    The sources making up this light, switched together as one unit.

    Declaration
    [Tooltip("    All the light sources representing the vehicle light.\r\n    E.g. low beam can be represented by a directional light to represent light beam and\r\n    and emissive mesh to represent light optics.")]
    public List<LightSource> lightSources
    Field Value
    Type Description
    List<LightSource>

    Properties

    On

    Gets or sets whether this light is currently on. When set directly, bypasses the normal TurnOn/TurnOff logic. Use SetState(), TurnOn(), or TurnOff() for proper control with source management.

    Declaration
    public bool On { get; set; }
    Property Value
    Type Description
    bool

    Methods

    SetState(bool)

    Sets the light state by calling TurnOn() or TurnOff() based on the state parameter.

    Declaration
    public void SetState(bool state)
    Parameters
    Type Name Description
    bool state

    True to turn on, false to turn off.

    Toggle()

    Toggles the light state. If currently on, turns it off. If currently off, turns it on.

    Declaration
    public void Toggle()

    TurnOff()

    Turns off every source in lightSources.

    Declaration
    public void TurnOff()

    TurnOn()

    Turns on every source in lightSources.

    Declaration
    public void TurnOn()
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics