VehicleComponent
is a building block of NWH Vehicle Physics 2.
VehicleController
is a collection of VehicleComponent
s, which includes VehicleModule
s, Effects
and SoundComponent
s - both of which inherit from VehicleComponent
.
VehicleComponent
that is enabled is updated.ManagerVehicleComponent
such as SoundManager
, EffectsManager
, ModuleManager
or Powertrain
also disables the child VehicleComponents
.lodIndex
value is lower than vehicleController.activeLodIndex
it will be enabled, otherwise it will be disabled. lodIndex
to a value less than 0 to ignore LODs.
Each VehicleComponent
has a state bar which is visible in play mode:
This is where the state of the VehicleComponent
can be checked and changed. Note that changing the state through state bar only affects runtime values and will revert after exiting play mode. The state bar is intended for previewing the current state and testing different values during run-time. For persistent state check StateSettings.
Enabled
button is greyed out as the LODs determine if the component will be enabled or disabled.VehicleComponent
on each VehicleController
, a ScriptableObject
StateSettings
was introduced.StateSettings
for each vehicle can be assigned under VehicleController ⇒ Settings tab. StateSettings
on State Settings page.
To change VehicleComponent
state through scripting following can be done:
myVehicleComponent.LodIndex = -1; // IMPORTANT! Setting this to -1 disables the // LODs which otherwise override the enabled/disabled setting. myVehicleComponent.VC_Enable(); myVehicleComponent.VC_Disable();
VehicleComponent
initialization and update functions start with the VC_
prefix to prevent confusion with Unity callbacks, e.g. VC_Initialize
or VC_FixedUpdate
.</wrap>