User Tools


State Settings

StateSettings inspector.

StateSettings is a ScriptableObject containing info about LODs and VehicleComponent states. The aim of StateSettings is to prevent having to set the state of each VehicleComponent on each VehicleController individually.

For more info about VehicleComponents and their states and LODs check VehicleComponent page.

LODs

  • If the component isOn and has LOD set (lodIndex >= 0) a piece of code is ran each frame to check if the lodIndex of the component is less or equal to the VehicleController's activeLodIndex.
  • If lodIndex is less or equal to activeLodIndex the component will be enabled, otherwise disabled.
  • When LOD system is active it overrides the ENABLED button for that component. To fully disable a component use ON button (isOn).
  • In NWH Vehicle Physics 2 LODs are also used instead of sleep system. When vehicle is asleep (IsAwake == false) last lod in the LODs list is forced no matter the distance. This is the best way to handle inactive, parked vehicles that still need to have a part of functionality enabled.
VehicleComponent that will be disabled while the vehicle is asleep.
VehicleComponent that will be left enabled while the vehicle is asleep.

Setting VehicleController.IsAwake to false will force last LOD, no matter the distance, for the duration the vehicle is asleep. Therefore it is a good idea to allocated the last lod as a vehicle inactive LOD.

State Definitions

  • Each VehicleComponent loads state from StateSettings. This is only done once, on VehicleComponent.Awake, so the StateSettings can also be thought of as initial vehicle component state settings.