Class Wheels
This class is used to manage a set of wheels for a vehicle, it does provide a bunch of helpers to make your life easier in orchestrating a set of wheels. It supports a variable number of wheels, you can add as many wheels as you want to your vehicle.
Namespace: YACC
Assembly: .dll
Syntax
[Serializable]
public class Wheels
Examples
Fields
Name | Description |
---|---|
wheels | The list of wheels attached to this vehicle. |
Properties
Name | Description |
---|---|
areGrounded | Checks if all wheels are touching ground, this is a shortcut to check if all wheels collider.isGrounded is set to true. |
brake | The brake power applied to all wheels. This should be specified in a float range from 0 to 1. The brake power is multiplied by the brakePower property set in this wheel. |
rpm | Retrieves the average RPM of all the wheels. |
rpmPowered | Retrieves the average RPM of all the powered wheels. |
rpmSteering | Retrieves the average RPM of all the steering wheels. |
steer | The steering angle of all steering wheels. This should be specified in a float range from -1 to 1. The steering angle is multiplied by the steerAngleMax property set in this wheel. |
torque | The torque applied all powered wheels. This should be specified in Newton Meters. |
Methods
Name | Description |
---|---|
Awake() | Call this from your controller's Awake method, it will initialize all wheels and count them. |
GetAverageCircumference() | Retrieves the average circumference of all the wheels. |
GetAverageRadius() | Retrieves the average radius of all the wheels. |
OnValidate() | Validates all attached wheels, to use in conjunction with your controller's OnValidate. |
Update() | Dispatches an update cycle to all sub-wheels. |