Class WheelControl
Bridges Unity's WheelCollider physics with one or more visual wheel meshes, and manages per-wheel steering, motor torque, braking, and drift visual effects.
[RequireComponent(typeof(WheelCollider))]
public class WheelControl : MonoBehaviour
Inheritance
Remarks
Each physical WheelCollider requires a separate WheelControl
because Unity's wheel physics is per-collider. This component owns the collider and
exposes a clean API (SetSteerInput, SetMotorTorque, SetBrakeTorque)
so PrometeoCarController does not need to know which wheel meshes exist.
The steeringCurve maps normalised steer input to wheel angle in degrees, allowing
non-linear steering response (e.g. reduced sensitivity at centre) without changing the
controller code. Smoke and skid-trail effects are activated based on wheel slip,
providing perceptual cues about traction loss to participants.
Fields
SmokeParticleSystem
Optional smoke particle system used for wheel slip effects.
[Tooltip("Optional smoke particle system used when the wheel slips.")]
public Optional<ParticleSystem> SmokeParticleSystem
Field Value
TireSkid
Optional trail renderer used to draw skid marks.
[Tooltip("Optional trail renderer used to draw tire skid marks.")]
public Optional<TrailRenderer> TireSkid
Field Value
motorized
If true, this wheel is motorized (receives motor torque).
[Tooltip("Indicates if this wheel is powered by the motor.")]
public bool motorized
Field Value
bool
steerable
If true, this wheel can steer.
[Tooltip("Indicates if this wheel is capable of steering.")]
public bool steerable
Field Value
bool
Methods
GetMaxSteeringAngle()
Returns the maximum angle (in degrees) this wheel can steer to, based on the steering curve.
public float GetMaxSteeringAngle()
Returns
float
SetBrakeTorque(float)
Applies brake torque to the WheelCollider.
public void SetBrakeTorque(float brakeTorque)
Parameters
| Name | Type | Description |
|---|---|---|
brakeTorque | float | The amount of braking force to apply. |
SetMotorTorque(float)
Applies motor torque to the WheelCollider.
public void SetMotorTorque(float motorTorque)
Parameters
| Name | Type | Description |
|---|---|---|
motorTorque | float | The amount of torque to apply. |
SetSmokeParticleActive(bool)
Activates/Deactivates the wheel's smoke particles, depending on the given true or false value.
public void SetSmokeParticleActive(bool value)
Parameters
| Name | Type | Description |
|---|---|---|
value | bool | Activate or deactivate the particles, where true activates the smoke particles and false deactivates the smoke particles. |
SetSteerInput(float)
Sets the steering input for this wheel.
public void SetSteerInput(float input)
Parameters
| Name | Type | Description |
|---|---|---|
input | float | Steering input from -1 (left) to 1 (right). |
SetTireSkidActive(bool)
Activates/Deactivates the wheel's tire skid trail, depending on the given true or false value, and whethever the wheel collider is on ground.
public void SetTireSkidActive(bool value)
Parameters
| Name | Type | Description |
|---|---|---|
value | bool | Activate or deactivate the tire skid, where true activates the tire skid and false deactivates the tire skid. |