Class Wheel
Represents the physical wheel and tire assembly with all related properties. Contains both the physical characteristics (radius, width, mass) and visual references.
Key components:
- Physical properties: Define wheel geometry and inertia
- Visual containers: Separate rotating and non-rotating parts
- Runtime state: Angular velocity, RPM, rotation angles
The wheel uses realistic physics calculations:
- Inertia = mass * radius²
- Angular velocity affects acceleration/braking response
- Width affects contact patch and ground detection
Note: Call WheelController.Initialize() after changing physical properties.
Namespace: NWH.WheelController3D
Assembly: NWH.WheelController.dll
Syntax
[Serializable]
public class Wheel
Fields
| Edit this page View SourceINERTIA_COEFFICIENT
Radius-of-gyration coefficient for wheel inertia. Tire+rim mass sits between a solid disc (0.5) and a thin ring (1.0); 0.65 reflects mass biased toward the rim/tread.
Declaration
public const float INERTIA_COEFFICIENT = 0.65
Field Value
| Type | Description |
|---|---|
| float |
MASS_DENSITY_COEFFICIENT
Density coefficient for wheel mass calculation. Empirically tuned so that a standard wheel (r=0.35m, w=0.25m) weighs ~30kg.
Declaration
public const float MASS_DENSITY_COEFFICIENT = 980
Field Value
| Type | Description |
|---|---|
| float |
angularVelocity
Current angular velocity of the wheel in radians per second [rad/s]. Positive values indicate forward rotation. Related to vehicle speed: linear_speed = angular_velocity * radius. Affected by motor torque, brake torque, and ground friction. High inertia wheels take longer to change angular velocity.
Declaration
[NonSerialized]
[Tooltip("Wheel rotation speed in rad/s. Positive = forward rotation.")]
public float angularVelocity
Field Value
| Type | Description |
|---|---|
| float |
autoCalculateMass
When true, mass is auto-calculated from radius and width. When false, mass can be set manually.
Declaration
[SerializeField]
[Tooltip("Automatically calculate mass from wheel dimensions. Disable to set manually.")]
public bool autoCalculateMass
Field Value
| Type | Description |
|---|---|
| bool |
axleAngle
Current cumulative rotation angle of the wheel around its axle in degrees. Continuously increases/decreases as wheel rotates (not clamped to 360). Used for visual rotation of the wheel mesh. Reset to 0-360 range periodically to prevent float overflow. Rotation axis is typically the local X-axis of the wheel.
Declaration
[NonSerialized]
[Tooltip("Cumulative wheel rotation angle in degrees. Used for visual rotation.")]
public float axleAngle
Field Value
| Type | Description |
|---|---|
| float |
inertia
Rotational inertia of the wheel in kg⋅m² [kilogram meter squared]. Calculated automatically via CalculateInertia(): inertia = INERTIA_COEFFICIENT * mass * radius². Higher inertia:
- Slower to accelerate/decelerate (more realistic for heavy wheels)
- Better maintains speed (momentum)
- May cause wheelspin under hard acceleration Lower inertia:
- More responsive throttle/brake
- Better for arcade-style handling Do not modify directly - change mass/radius and call Initialize().
Declaration
[Tooltip("Wheel rotational inertia in kg⋅m². Higher = slower to change speed.")]
[ShowInTelemetry(NaN, NaN, null, null, 1)]
public float inertia
Field Value
| Type | Description |
|---|---|
| float |
localAxleRotation
Rotation of the wheel including axle rotation, camber rotation, damage rotation, and any other rotation around the wheel axle. Does not include steer rotation.
Declaration
[NonSerialized]
[Tooltip("Rotation of the wheel including axle rotation, camber rotation, damage rotation, and any other rotation\r\naround the wheel axle. Does not include steer rotation.")]
public Quaternion localAxleRotation
Field Value
| Type | Description |
|---|---|
| Quaternion |
mass
Mass of the wheel assembly (rim + tire) in kilograms [kg]. Auto-calculated from radius and width when autoCalculateMass is true. Used to calculate rotational inertia but does NOT affect vehicle weight.
Declaration
[SerializeField]
[Tooltip("Wheel mass in kg. Auto-calculated or manually set.")]
[ShowInTelemetry(NaN, NaN, null, null, 1)]
public float mass
Field Value
| Type | Description |
|---|---|
| float |
meshCollider
MeshCollider that handles wheel collisions when suspension can't provide enough force. Automatically generated cylinder mesh covering the wheel. Active when:
- Vehicle is upside down or on its side
- Suspension bottoms out (harsh landings)
- No suspension (wheel directly on collider) Uses zero friction to let WheelController handle all friction calculations. Do not modify or remove - managed automatically by WheelController.
Declaration
[Tooltip("Auto-generated collider for edge cases. Do not modify manually.")]
public MeshCollider meshCollider
Field Value
| Type | Description |
|---|---|
| MeshCollider |
nonRotatingContainer
Transform container for parts that move with suspension but don't rotate with the wheel. Parent these objects to this container:
- Brake calipers
- Mud guards/fenders (if attached to suspension)
- Suspension components (control arms, springs)
- Wheel speed sensors
This container follows suspension movement (up/down) and steering angle, but does not rotate with wheel spin. Automatically created as "NonRotating" child if not assigned.
Declaration
[Tooltip("Container for non-rotating parts like brake calipers. Follows suspension but doesn't spin.")]
public Transform nonRotatingContainer
Field Value
| Type | Description |
|---|---|
| Transform |
nonRotatingVisual
!OBSOLETE! - Check the v11 to v12 upgrade notes! Parent the visual to the rotatingContainer instead. Object representing non-rotating part of the wheel. This could be things such as brake calipers, external fenders, etc.
Declaration
[Obsolete]
[Tooltip("!OBSOLETE! - Check the v11 to v12 upgrade notes! Parent the visual to the rotatingContainer instead.Object representing non-rotating part of the wheel. This could be things such as brake calipers, external fenders, etc.")]
public GameObject nonRotatingVisual
Field Value
| Type | Description |
|---|---|
| GameObject |
radius
Total radius of the wheel (rim + tire) in meters [m]. Measured from axle center to tire tread surface.
Typical values:
- Motorcycles: 0.25-0.35m
- Small cars: 0.28-0.32m
- Standard cars: 0.30-0.38m
- SUVs/Trucks: 0.35-0.50m
- Monster trucks: 0.60-1.00m
Affects:
- Vehicle speed (larger = higher speed at same RPM)
- Torque at ground (larger = less torque multiplication)
- Ground clearance and suspension geometry
Call WheelController.Initialize() after changing!
Declaration
[Min(0.001)]
[ShowInTelemetry(NaN, NaN, null, null, 1)]
[Tooltip("Wheel radius in meters. Affects speed, torque, and clearance. Call Initialize() after changing!")]
public float radius
Field Value
| Type | Description |
|---|---|
| float |
rimOffset
Lateral offset of the wheel rim from the suspension pivot point in meters [m]. Also known as wheel offset or ET (Einpresstiefe).
Effects:
- Positive: Wheel moves outward (wider track)
- Negative: Wheel moves inward (narrower track)
- Changes scrub radius and steering feel
- Affects suspension geometry and roll center
Typical values:
- Standard cars: 0.03-0.06m
- Wide body/stance: 0.08-0.15m
- Trucks (dual wheels): 0.15-0.25m
Used for steering pivot calculation.
Declaration
[Tooltip("Wheel lateral offset in meters. Positive = outward. Affects steering geometry.")]
public float rimOffset
Field Value
| Type | Description |
|---|---|
| float |
rotatingContainer
Transform container for all parts that rotate with the wheel. Parent these objects to this container:
- Wheel mesh (rim and tire)
- Brake discs/rotors
- Wheel bolts/nuts (visual)
- Hubcaps or center caps
This container handles:
- Wheel spin rotation (rolling)
- Suspension movement (up/down)
- Steering angle
- Camber angle
Automatically created as "Rotating" child if not assigned. First child should be the main wheel mesh for auto-sizing.
Declaration
[Tooltip("Container for rotating parts like wheel mesh and brake discs. Spins with wheel.")]
public Transform rotatingContainer
Field Value
| Type | Description |
|---|---|
| Transform |
rpm
Current wheel rotation speed in revolutions per minute [RPM]. Calculated from angular velocity: RPM = angularVelocity * 9.55. Positive values indicate forward rotation.
Useful for:
- Dashboard/HUD displays
- Gear shift calculations
- Sound system (tire noise pitch)
- Visual effects (motion blur intensity)
Relationship to speed: vehicle_speed ≈ (RPM / 60) * 2π * radius
Declaration
[ShowInTelemetry(0, 100, "0", "RPM", 1)]
[Tooltip("Wheel rotation speed in RPM. Positive = forward.")]
public float rpm
Field Value
| Type | Description |
|---|---|
| float |
visual
!OBSOLETE! - Check the v11 to v12 upgrade notes! Parent the visual(s) to the rotatingContainer instead. GameObject representing the visual aspect of the wheel / wheel mesh. Should not have any physics colliders attached to it.
Declaration
[Obsolete]
[Tooltip("!OBSOLETE! - Check the v11 to v12 upgrade notes! Parent the visual(s) to the rotatingContainer instead.GameObject representing the visual aspect of the wheel / wheel mesh.\r\nShould not have any physics colliders attached to it.")]
public GameObject visual
Field Value
| Type | Description |
|---|---|
| GameObject |
width
Width of the tire tread in meters [m]. Affects ground detection area and visual appearance.
Typical values:
- Motorcycles: 0.08-0.20m
- Small cars: 0.155-0.195m (155-195mm tires)
- Standard cars: 0.195-0.255m (195-255mm tires)
- Sports cars: 0.225-0.335m (225-335mm tires)
- SUVs/Trucks: 0.235-0.355m (235-355mm tires)
Effects:
- Wider = larger contact patch, potentially more grip
- Wider = better stability but more rolling resistance
- Ground detection samples across entire width
Call WheelController.Initialize() after changing!
Declaration
[Min(0.001)]
[Tooltip("Tire width in meters. Affects contact patch. Call Initialize() after changing!")]
public float width
Field Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceCalculateInertia()
Calculates wheel rotational inertia from mass and radius. Formula: inertia = INERTIA_COEFFICIENT * mass * radius²
Declaration
public float CalculateInertia()
Returns
| Type | Description |
|---|---|
| float |
CalculateMass()
Calculates expected wheel mass from radius and width. Formula: mass = MASS_DENSITY_COEFFICIENT * radius² * width
Declaration
public float CalculateMass()
Returns
| Type | Description |
|---|---|
| float |