Class WheelGroup
Represents a group of wheels that share common properties and behaviors. Typically used to represent an axle, connecting wheels to differentials and applying brake distribution, steering coefficients, and wheel geometry settings.
Namespace: NWH.VehiclePhysics2.Powertrain.Wheel
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class WheelGroup
Fields
addAckerman
Determines whether Ackerman steering geometry should be applied to this wheel group. Ackerman steering adjusts inner and outer wheel angles during turns to reduce tire scrub. The angle is automatically calculated based on the vehicle's wheelbase and track width.
Declaration
[ShowInSettings("Add Ackerman")]
[Tooltip("Should the Ackerman steering angle be added to the axle?\r\nThe angle is auto-calculated.")]
public bool addAckerman
Field Value
| Type | Description |
|---|---|
| bool |
applyCasterAngle
Determines whether the caster angle should be applied to wheels in this group. Caster angle affects steering feel and self-centering behavior.
Declaration
[Tooltip("Set to true if the caster angle should be applied to the wheel group.")]
public bool applyCasterAngle
Field Value
| Type | Description |
|---|---|
| bool |
applyToeAngle
Determines whether the toe angle should be applied to wheels in this group. Toe angle affects straight-line stability and turn-in response.
Declaration
[Tooltip("Set to true if the toe angle should be applied to the wheel group.")]
public bool applyToeAngle
Field Value
| Type | Description |
|---|---|
| bool |
brakeCoefficient
Brake torque distribution coefficient for this wheel group. A value of 1 means the group receives full brake torque as defined by the vehicle's max brake torque. A value of 0 means no braking is applied to this group. Intermediate values proportionally reduce the applied brake torque.
Declaration
[Tooltip("If set to 1 axle will receive full brake torque as set by Max Torque parameter under Brake section while 0 means no breaking at all.")]
[Range(0, 1)]
[ShowInSettings("Brake Coeff.", 0, 1, 0.1)]
public float brakeCoefficient
Field Value
| Type | Description |
|---|---|
| float |
handbrakeCoefficient
Handbrake torque distribution coefficient for this wheel group. A value of 1 means the group receives full brake torque when the handbrake is applied. A value of 0 means the handbrake has no effect on this group. Values above 1 can be used to apply more handbrake force than regular braking.
Declaration
[Range(0, 2)]
[ShowInSettings("Brake Coeff.", 0, 1, 0.1)]
[Tooltip("If set to 1 axle will receive full brake torque when handbrake is used.")]
public float handbrakeCoefficient
Field Value
| Type | Description |
|---|---|
| float |
isSolid
When enabled, treats the wheel group as a solid axle for camber calculation. Camber angles are automatically calculated based on the suspension travel difference between left and right wheels, simulating a rigid axle connection. Only works when the group contains exactly two wheels.
Declaration
[Tooltip("Setting to true will override camber settings and camber will be calculated from position of the (imaginary) axle object instead.")]
[ShowInSettings]
public bool isSolid
Field Value
| Type | Description |
|---|---|
| bool |
name
Name of the wheel group for identification purposes. Typically describes the axle position (e.g., "Front Axle", "Rear Axle").
Declaration
[Tooltip("Name of the WheelGroup.")]
public string name
Field Value
| Type | Description |
|---|---|
| string |
steerCoefficient
Steering coefficient determining how much steering input is applied to this wheel group. A value of 1 applies full steering angle, 0 means no steering. Negative values reverse the steering direction, useful for rear-wheel steering or counter-steering setups.
Declaration
[Tooltip("Determines what percentage of the steer angle will be applied to the wheel. If set to negative value wheels will turn in direction opposite of input.")]
[Range(-1, 1)]
[ShowInSettings("Steer Coeff.", -1, 1, 0.1)]
public float steerCoefficient
Field Value
| Type | Description |
|---|---|
| float |
trackWidth
Distance between the left and right wheels in this group (track width). Automatically calculated when the group contains exactly two wheels. Zero otherwise. Used for solid axle camber calculations and Ackerman steering geometry.
Declaration
[Tooltip("Width of the axle track. 0 if wheel count is not 2.")]
public float trackWidth
Field Value
| Type | Description |
|---|---|
| float |
vc
Reference to the parent VehicleController.
Declaration
public VehicleController vc
Field Value
| Type | Description |
|---|---|
| VehicleController |
wheels
List of all WheelComponents belonging to this group.
Declaration
[SerializeField]
public List<WheelComponent> wheels
Field Value
| Type | Description |
|---|---|
| List<WheelComponent> |
Properties
CasterAngle
Gets or sets the caster angle. Setting this property automatically applies the geometry values to all wheels.
Declaration
public float CasterAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
ToeAngle
Gets or sets the toe angle. Setting this property automatically applies the geometry values to all wheels.
Declaration
public float ToeAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Wheels
Gets the list of WheelComponents in this group.
Declaration
public List<WheelComponent> Wheels { get; }
Property Value
| Type | Description |
|---|---|
| List<WheelComponent> |
Methods
AddWheel(WheelComponent)
Adds a wheel to this group and sets the wheel's group reference.
Declaration
public void AddWheel(WheelComponent wheel)
Parameters
| Type | Name | Description |
|---|---|---|
| WheelComponent | wheel | The WheelComponent to add to the group. |
ApplyGeometryValues()
Applies toe and caster angle settings to all wheels in the group. Automatically mirrors angles for left and right wheels based on their position.
Declaration
public void ApplyGeometryValues()
FindBelongingWheels()
Finds all wheels that belong to this group based on their WheelGroupSelector index, adds them to the group, and calculates the track width if exactly two wheels are found.
Declaration
public void FindBelongingWheels()
FindWheelsBelongingToGroup(ref List<WheelComponent>, int)
Finds all wheels from the provided list that have their WheelGroupSelector set to this group's index.
Declaration
public List<WheelComponent> FindWheelsBelongingToGroup(ref List<WheelComponent> inWheels, int thisGroupIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| List<WheelComponent> | inWheels | The list of wheels to search through. |
| int | thisGroupIndex | The index of this group in the vehicle's wheelGroups list. |
Returns
| Type | Description |
|---|---|
| List<WheelComponent> | A list of WheelComponents that belong to this group. |
Initialize()
Initializes the wheel group by finding and assigning all wheels that belong to it, then applies the geometry settings to those wheels.
Declaration
public void Initialize()
RemoveWheel(WheelComponent)
Removes a wheel from this group.
Declaration
public void RemoveWheel(WheelComponent wheel)
Parameters
| Type | Name | Description |
|---|---|---|
| WheelComponent | wheel | The WheelComponent to remove. |
SetWheels(List<WheelComponent>)
Sets the wheels for this group and updates their group references.
Declaration
public void SetWheels(List<WheelComponent> inWheels)
Parameters
| Type | Name | Description |
|---|---|---|
| List<WheelComponent> | inWheels | The list of wheels to assign to this group. |
Update()
Updates the wheel group each frame. Calculates solid axle camber. Supports 2-wheel axles directly and multi-wheel axles (tandem/tridem) by processing consecutive left/right pairs.
Declaration
public void Update()