Powertrain

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.

Powertrain menu for filtering between component types.
Example of typical Powertrain setup for 4-wheel, 4WD vehicle.
  • Each component outputs to one or more 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.

Solver

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.

2020/04/08 12:36

PowertrainComponent

PowertrainComponent is a base class for all powertrain components: EngineComponent, ClutchComponent, TransmissionComponent, etc.

  • All the PowertrainComponents have the following common fields in the inspector:
    • Name - name of the component. Changing the Nameof a component will reset Outputon 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 Componentto which the torque is forwarded. In cases such as Differential Componentthere can be multiple outputs (e.g. left and right wheel).
Common PowertrainComponent fields.
  • Changing the name field on component will reset all the Outputs on other PowertrainComponents that use that component as an output.
  • Increasing Inertia will will make the component spin up slower if the same torque is applied.
  • Inertia of WheelComponent is calculated from WheelControllers mass and radius settings.

Inertia must always be larger than 0!

2020/04/08 12:36

Engine

EngineComponent is a mandatory Powertrain component. It is always first in the Components list.

Inertia

Higher engine inertia results in an engine that is harder to stall. Such engine will also take longer to spin up.

Power Curve

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.

Similar power output, different power curves.

Idler Circuit

Idler circuit tries to keep RPM at Idle RPM when there is no user input.

Starter

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.

Rev Limiter

Cuts throttle to the engine when RPM reaches Rev Limiter RPM for a duration of Rev Limiter Cutoff Duration.

Forced Induction

ForcedInduction inspector.
  • 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.
  • Boost value affects sound components TurboWhistleComponent and TurboFlutterComponent. If forced induction is to be used just for the sound effects Power Gain Multiplier should be set to 1.
2020/04/08 12:36

Power Modifiers

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.

2020/04/08 12:36

Clutch

ClutchComponent inspector.

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.

Manual Control

  • Untick Is Automatic to use manual clutch.
  • Clutch can be controlled through Clutch axis - check Input section for more info on setting up axes.

PID Controller

PID controller is used to control Clutch Engagement when Is Automatic is true.

  • More about PID controllers here.
  • In general default clutch settings should be adequate for most setups.
  • PID_Coefficient can be adjusted to slow down or speed up clutch engagement.

Slip Torque

  • When Has Torque Converter is false Slip Torque is used. Otherwise, clutch will use Torque Converter Slip Torque. \\]
  • Slip torque for a normal clutch should be a bit higher than the maximum engine torque. Usually a few hundred to a few thousand Nm.
  • Too high Slip Torque will result in grabby clutch.
  • Using too high Slip Torque values can result in torque spikes when clutch is suddenly released which can impact solver stability in extreme cases.
  • Values near zero will result in engine spinning up as if the clutch is not engaged due to clutch slip.
2020/04/08 12:36

Transmission

TransmissionComponent inspector.

  • TransmissionComponent is a mandatory Powertrain component. It is always third in the Powertrain.Components list.
  • NWH Vehicle Physics uses gear ratios – just like the real transmission does.
  • If gears are not set up properly the vehicle will not move.
  • There are a few included TransmissionGearingProfiles which can be used as an example.

Gearing

  • Gearing is assigned through TransmissionGearingProfile ScriptableObject.
  • Gear ratios can be adjusted during run-time.
  • For more info check Transmission Gearing Profile page.

Transmission Types

Manual
  • Changing gears can only be done through user input. Check Input Setup for more info on input bindings.
Automatic
  • Vehicle shifts gears based on the gear ratios and 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).
  • You can check the current Target Upshift RPM and Target Downshift RPM under the Shifting section of the TransmissionComponent inspector. These values vary depending on the variables mentioned above.

Vehicle under full throttle:

Same vehicle with 0 throttle:

Automatic Squential

Same as Automatic but without gear skipping.

CVT
  • CVT (and eCVT) transmissions have variable gearing ratio dependent on load.
  • Gear ratio will be interpolated between first and second element in Forward Gears list based on input torque

and Cvt Max Input Torque field value.

Example transmission gearing profile for CVT transmission:

External
  • Shift delegate is used for changing gears.
  • This allows for external shifting logic.
  • If the delegate is not assigned this option will result in no gear shifts.

Timing

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.

Shift Conditions

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 ShiftCheckdelegates. 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:

Transmission Gearing Profile

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:
    • 1st gear = 3.25 ratio
    • 2nd gear = 2.23 ratio
    • 3rd gear = 1.66 ratio
  • Reverse Gears list contains all reverse gear ratios. Multiple reverse gears can be added, e.g.
    • 1st reverse gear = -3.79 ratio
    • 2nd reverse gear = -2.61 ratio
  • 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.
2020/04/08 12:36
2020/04/08 12:36

Differentials

DifferentialComponent inspector.

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.

Differential Types

Open

Torque in open differential is equally split between the left output and right output.

Locked

Locked differential keeps both outputs rotating at same angular velocity.

Viscous LSD

A type of limited slip differential (LSD). Torque is split based on difference in speed between the two outputs.

Clutch LSD

Also known as cone-type or plate limited slip differential (LSD). Torque is split based on speed difference between the two inputs and the input torque.

2020/04/08 12:36

WheelComponents

WheelComponent inspector.
  • 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.
2020/04/08 12:36

Wheel Groups / Axles

WheelGroup inspector.

Steering

  • 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.
Vehicle with Steer Coefficient of 1 on the front axle and -0.5 on the rear axle. Steering wheel turned fully to the right.
  • 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:
Effect of Ackerman setting on steering.

Brakes

  • Brake Coefficient - amount of brake torque used as a percentage of BrakesMax Torque.
  • Handbrake Coefficient - amount of brake torque applied when handbrake is activated.

Geometry

  • Toe Angle - toe angle in degrees.
Toe angle. Positive on the left (toe-in) and negative on the right (toe-out).
  • Caster Angle - caster angle in degrees.
ImageCaption
  • 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

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.
2020/04/08 12:37