WheelHit
Contact information for the wheel, reported by WheelCollider.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Struct
- Namespace: UnityEngine
- Assembly: UnityEngine.VehiclesModule
public struct WheelHit
Remarks
Friction for the WheelCollider is computed separately from the rest of the physics, using a slip based tire friction model. This allows for more realistic behaviour, but makes wheel colliders ignore standard PhysicsMaterial settings.
The way to simulate different ground materials is to query WheelCollider for its collision information (see WheelCollider.GetGroundHit). Usually, you get the other collider the wheel is hitting, and modify the wheel's _forwardFriction and _sidewaysFriction based on the physics material of the ground.
The other members of the WheelHit structure are usually queried for information purposes or special effects. For example, a "slipping tire" sound can be played if _forwardSlip or _sidewaysSlip exceed some threshold.
Additional Resources: WheelCollider.GetGroundHit
Properties
Property | Description |
|---|---|
| collider | The other Collider the wheel is hitting. |
| force | The magnitude of the force being applied for the contact. |
| forwardDir | The direction the wheel is pointing in. |
| forwardSlip | Tire slip in the rolling direction. Acceleration slip is negative, braking slip is positive. |
| normal | The normal at the point of contact. |
| point | The point of contact between the wheel and the ground. |
| sidewaysDir | The sideways direction of the wheel. |
| sidewaysSlip | Tire slip in the sideways direction. |