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 PowertrainComponent
serves as a foundational class for all powertrain components, including EngineComponent
, ClutchComponent
, TransmissionComponent
, and others.
Each PowertrainComponent
possesses the following shared attributes in the Inspector:
Name
- The label assigned to the component. Note that altering the Name
of a component will reset the * * Output
for any components that utilize that component.Inertia
- Represents the inertia of the component. The inertia of each component contributes to the overall system inertia, which determines the difficulty of spinning the component up or down.Output
- Specifies the Powertrain Component
to which torque is forwarded. For certain components, such as * Differential Component
, multiple outputs may be present (e.g., left and right wheel).Keep in mind the following:
name
field of a component resets all the Output
s for other PowertrainComponent
s that rely on that component as an output.Inertia
value will cause the component to spin up more slowly when the same amount of torque is applied.Inertia
of a WheelComponent
is determined by the WheelController
s mass and radius settings.
Always ensure that the Inertia
value is greater than 0!
The engine acts as a source of power/torque and updates the components attached to it recursively with the generated torque.
When using the Electric engine, consider setting the output to the Transmission, bypassing the Clutch, as it is not needed.
Higher engine inertia results in an engine that is harder to stall. The such engine will also take longer to spin up. Typical values:
The power curve represents engine power across its RPM range.
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
.
Note that power and torque curves show the exact same data since the power is a function of torque and RPM, so knowing two of the three is enough. Since power curves are usually easier to find, NVP2 uses a power curve instead of a torque curve.
The Idler circuit tries to keep RPM at Idle RPM
when there is no user input. This is done through throttle modulation so it is still possible to stall the engine if stallingEnabled = true
.
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 and overcome the losses. The amount of torque needed is automatically calculated based on the engine inertia, Power Curve, and the Start Duration value.
When Flying Start is enabled, the engine spins up instantly without running the starter. This is to give an illusion of the engine already having been started when the vehicle is woken up.
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 the TCS module which uses this mechanic to limit power when there is wheel spin.
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.
There are two things to note here: clutch engagement and clutch input. Clutch input controls the engagement through the Engagement Curve and is set either automatically, through user input, or scripting/inspector. It is best to think of the Clutch Input value as the pedal position, and the engagement as the “biting point” of the clutch.
Automatic
sets the clutch engagement based on the input (engine) RPM. engagementRPM
, throttleEngagementOffsetRPM
and engagementRange
.UserInput
type can be used to give control to the user through a gamepad, steering wheel, etc.Clutch
axis - check Input section for more info on setting up axes.Manual
type does not set the clutch value in any way and instead expects to be set externally, either through the inspector or through scripting.Has Torque Converter
is false Slip Torque
is used. Otherwise, the clutch will use Torque Converter Slip Torque
. \\]Slip Torque
will result in grabby clutch.Slip Torque
values can result in torque spikes when the 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.
The asset uses W/S to select the movement direction by default. To use W/S as throttle/brake exclusively go to Control > Input and tick Swap Input In Reverse
.
gears
list and should be ordered from reverse, then neutral (always 0), then forward gear ratios. Upshift RPM
, Downshift RPM
, Variable Shift Intensity
and Incline Effect Coeff
variables.Target Upshift RPM
and Target Downshift RPM
can be seen under the under the Shifting section of the TransmissionComponent
inspector, during runtime. These values vary depending on the variables mentioned above.IsSequential
makes the transmission be able to shift only one gear up or down at the time. It has the same effect as ticking both Allow Upshift Gear Skipping
and Allow Downshift Gear Skipping
.CVT
(and eCVT) transmissions have variable gearing ratio dependent on load.Shift
delegate inside TransmissionComponent
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.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 the ticked conditions conditions have been met for Shift Check Cooldown
seconds:
Wheel Spin
- longitudinal slip on all wheels is less than Longitudinal Slip Threshold
(Settings tab)Wheel Skid
- lateral slip on all wheels is less than Lateral Slip Threshold
(Settings tab)Wheel Air
- none of the wheels are in the air.External Shifts Checks Valid
- list of ShiftCheck
delegates. All external shift checks must be valid for transmission to be able to shift.
Transmission gearing profiles were deprecated in favor of a simple gears
list.
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.
Unused differentials should be removed. E.g. a front differential that none of the other powertrain components (transmission, other differentials, etc.) are outputting to should be removed, as only powertrain components that have a path to Engine are updated.
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.
To achieve a specific drivetrain configuration, different differential layouts can be used. For example:
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
or WheelCollider
. WheelComponent
instead interfaces between the powertrain an the wheel.Belongs To
field determines to which WheelGroup the WheelComponent
belongs to. This determines values such as braking, steering and geometry. Inertia
field gets auto-calculated from assigned WheelController
's mass and radius.WheelUAPI
field accepts any wheel controller/collider that uses the WheelUAPI abstract class as its base. The two shipped with the asset are WheelController
and WheelColliderUAPI
. This means that NVP2 can work with any wheel solution as long as it implements WheelUAPI. The reason why WheelUAPI
is not a pure interface is due to the Unity's serialization (or lack of it) for interfaces.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.Add Ackerman
- check this Wikipedia link for more info about Ackerman Steering setup. 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.isSolid
being true, as in that case the camber is calculated so that the wheels always stay parallel to each other.
Axle settings are used only if there are exactly two wheels in the WheelGroup
.
Anti Roll Bar Force
- deprecated, Force Application Point Distance
on WheelController
should be used instead. Higher the value, lower the roll.Is Solid
- Imitates solid axle and auto-adjusts camber to make sure that both wheels always stay parallel to each other.