NWH Vehicle Physics 2 uses different solver from NWH Vehicle Physics 1. Solver in NWH Vehicle Physics uses multiple ticks per one FixedUpdate
and is physically accurate. The only component that is approximated is the clutch and that is due to performance reasons.
Powertrain
in NWH Vehicle Physics 2 is a collection of Powertrain Components such as EngineComponent
, ClutchComponent
, DifferentialComponent
, etc.
PowertrainComponents
, except for WheelComponent
which always outputs to WheelController
.EngineComponent
which acts as a power source and Wheel Component
acts as a power sink. The components in-between determine how the power/torque will be transmitted.
The only setting available for solver is
Physics Quality
. Physics Quality
changes the number of ticks per one FixedUpdate:
* Low
- 8 ticks
* Medium
- 12 ticks
* High
- 16 ticks
* Very High
- 24 ticks
* Ultra
- 32 ticks
* Overkill
- 48 ticks
* Performance impact is directly proportional to the number of ticks. Powertrain
code is heavily optimized.
* Using very low values (<8) can result in low simulation fidelity and/or instability, especially if used with high power vehicles, high gear ratios or complex differential setups.
Since v1.4 physics quality can be adjusted under Settings tab by changing the number of physics substeps.
PowertrainComponent
is a base class for all powertrain components: EngineComponent
, ClutchComponent
, TransmissionComponent
, etc.
PowertrainComponent
s have the following common fields in the inspector:Name
- name of the component. Changing the Name
of a component will reset Output
on any components that are using that component.Inertia
- inertia of the component. Inertia of each component contributes to the total system inertia. How much depends on the clutch engagement and current gear ratio.Output
- Powertrain Component
to which the torque is forwarded. In cases such as Differential Component
there can be multiple outputs (e.g. left and right wheel).name
field on component will reset all the Output
s on other PowertrainComponent
s that use that component as an output.Inertia
will will make the component spin up slower if the same torque is applied.Inertia
of WheelComponent
is calculated from WheelController
s mass and radius settings.
Inertia
must always be larger than 0!
Higher engine inertia results in an engine that is harder to stall. Such engine will also take longer to spin up.
Power curve represents engine power across its RPM range.
Both X and Y values are normalized where X (0 to 1) represents RPM as a percentage of Rev Limiter RPM
and Y (0 to 1) represents power as a percentage of Max Power
.
Idler circuit tries to keep RPM at Idle RPM
when there is no user input.
Starter spins up the engine to try and reach the RPM at which the power generated by the engine is enough for it to spin by itself. If too low Starter Torque
is used or Starter RPM Limit
is lower than Stall RPM
of the engine, the engine will fail to start.
Cuts throttle to the engine when RPM reaches Rev Limiter RPM
for a duration of Rev Limiter Cutoff Duration
.
ForcedInduction
is a part of EngineComponent
. It can be used for both turbocharging and supercharging the vehicle. Power Gain Multiplier
adds power on top of the existing Max Power
so the vehicle with 100kW and Power Gain Multiplier
of 1.5 will actually produce 150kW.TurboWhistleComponent
and TurboFlutterComponent
. If forced induction is to be used just for the sound effects Power Gain Multiplier
should be set to 1.
Power modifiers can be used through scripting to modify the power of the engine. These are functions that return a float
which denotes an engine power coefficient. Example:
public float AddBoost() { if(boostIsActive) { return 1.5f; // Increases power for 50%. } } ... myVehicleController.powertrain.engine.powerModifiers.Add(AddBoost);
This is a fictional example. A concrete example can be found inside TCS module which uses this mechanic to limit power when there is wheel spin.
ClutchComponent
is a mandatory Powertrain
component. It is always second in the Components
list.
ClutchComponent
can be bypassed by setting the output of EngineComponent
directly to the desired PowertrainComponent
but this is not recommended as it will cause stalling in most cases.Is Automatic
to use manual clutch.Clutch
axis - check Input section for more info on setting up axes.
PID controller is used to control Clutch Engagement
when Is Automatic
is true.
PID_Coefficient
can be adjusted to slow down or speed up clutch engagement.Has Torque Converter
is false Slip Torque
is used. Otherwise, clutch will use Torque Converter Slip Torque
. \\]Slip Torque
will result in grabby clutch.Slip Torque
values can result in torque spikes when clutch is suddenly released which can impact solver stability in extreme cases.TransmissionComponent
is a mandatory Powertrain
component. It is always third in the Powertrain.Components
list.TransmissionGearingProfiles
which can be used as an example. TransmissionGearingProfile
ScriptableObject
.Upshift RPM
, Downshift RPM
, Variable Shift Intensity
and Incline Effect Coeff
variables. Gear skipping is enabled (e.g. it is possible that the vehicle will shift from 1st to 3rd if conditions are right).Target Upshift RPM
and Target Downshift RPM
under the Shifting section of the TransmissionComponent
inspector. These values vary depending on the variables mentioned above.
Same as Automatic
but without gear skipping.
CVT
(and eCVT) transmissions have variable gearing ratio dependent on load.Shift
delegate is used for changing gears.To make shifting more realistic two timers have been added:
Shift Duration
- time Transmission
takes to change from one gear to another. During this time EngineComponent
's throttle is cut off. Works for all transmission types that shift gears.Post Shift Ban
timer. This field determines minimum time between two shifts. Used to prevent transmission for shifting too often. Only affects automatic transmission types.
Transmission will only shift in automatic mode if ALL of the following conditions are met and after they have been met for Shift Check Cooldown
seconds:
No Wheel Spin
- longitudinal slip on all wheels is less than Longitudinal Slip Threshold
(Settings tab)No Wheel Skid
- lateral slip on all wheels is less than Lateral Slip Threshold
(Settings tab)No Wheel Air
- none of the wheels are in the air.Clutch Engaged
- clutch is fully engaged.External Shifts Checks Valid
- list of ShiftCheck
delegates. All external shift checks must be valid for transmission to be able to shift.
You can check the state of shift conditions in the inspector:
TransmissionGearingProfile
is a ScriptableObject
that determines the gear ratios for the TransmissionComponent.
Forward Gears
list contains all forward gear ratios in order from 1st gear up. In the example above:Reverse Gears
list contains all reverse gear ratios. Multiple reverse gears can be added, e.g.Final Gear Ratio
is the coefficient by which all the gears are multiplied. This is very similar to differential gear ratio and can be used to tune the gearing without having to adjust the gearing between individual ratios.
DifferentialComponent
is a type of PowertrainComponent
that splits input torque between two or more outputs.
There can be multiple DifferentialComponents
present on one vehicle and one differential can output to other differentials which is useful for 4WD setup with center differential.
Torque in open differential is equally split between the left output and right output.
Locked differential keeps both outputs rotating at same angular velocity.
Replaces previous separate ViscousLSD and ClutchLSD options. Torque will be sent to the slower spinning wheel, keeping the wheels locked, up to the slip torque value.
Can be used to assign an external differential delegate function.
WheelComponent
is a PowertrainComponent
. It acts as a torque sink and can not output to another PowertrainComponent
WheelComponent
should not be mixed up with WheelController
which is a replacement for Unity's WheelCollider
.Belongs To
field determines to which WheelGroup the WheelComponent
belongs to. This will determines values such as braking and steering coefficients and geometry.Inertia
field gets auto-calculated from assigned WheelController
's mass and radius.Steer Coefficient
determines how much the wheel will steer depending on input. In general cars would have Steer Coefficient
of 1 in front and 0 in the back, except for four wheel steering cars where rear axle usually steers opposite of the front so the value would be negative. Examples: 1
- 100% steering. 0
- no steering.-0.5
- 50% steering in the opposite direction.Ackerman Percent
- check this Wikipedia link for more info about Ackerman Steering setup. Set to <0 for Reverse or Anti Ackermann or >0 for Ackermann steering. Field represents percent where 0.12 equals 12% of the steer angle. Following image describes the effect:Brake Coefficient
- amount of brake torque used as a percentage of Brakes
⇒ Max Torque
.Handbrake Coefficient
- amount of brake torque applied when handbrake is activated.Toe Angle
- toe angle in degrees.Caster Angle
- caster angle in degrees.Camber At Top
and Camber At Bottom
- camber angle in degrees at the top (fully compressed) and the bottom (fully relaxed) of suspension travel. Current value will be an interpolated result between the two.
Axle settings are used only if there are exactly two wheels in the WheelGroup
.
Anti Roll Bar Force
- force that imitates anti-roll bar in a vehicle. Before increasing value it is best to make sure that the center of mass of the vehicle is correct as too high center of mass can result in unstable vehicle. Too high values can introduce jitter to the vehicle as the ARB will try to equalize the suspension travel of both wheels Is Solid
- Imitates solid axle and auto-adjusts camber to make sure that both wheels always stay parallel to each other.