• Type : Public class
  • Inherents from MonoBehaviour
  • Namespace : SlateShipyard.Modules.Wheels

This is a script which allows you to have simple wheel simulations with suspension, friction and other stuff.

This simulation uses a single raycast to represent the wheel and its suspension, if you want to have a more in depth look on how it works watch these series of videos.


Public Properties


The radius of the wheel.


The lenght which the suspension considers to be at rest.


The distance which the suspension can travel.

The max and min lenght it can have are calculated from this equation: minLenght = restLenght - springTravel; maxLenght = restLenght + springTravel.


The spring constant of the suspension.


The damping constant of the suspension.

Usually make it smaller then the springStiffness to have better results.


The coeficient for the friction the wheel will experience for its foward direction velocity when touching a ground.

Usually make it a value between 1.0 and 0.0, 0.0 being like driving in ice and 1.0 like in glue.


The coeficient for the friction the wheel will experience for velocities that aren't on the wheel direction.

This means that if the wheel is sliding, this friction force will try to reduce this motion.


The target angle (in degrees) which you want the wheel to be at.


The 'time' that the wheel will take to reach the target angle in steerAngle.

Bigger values make it reach the end value faster.


The Rigidbody the wheel will use to apply the forces it calculates.


The LayerMask it will use on the raycast to be considered as valid ground.


Public Methods

bool IsOnGround()

Returns true if the wheel is hitting a valid ground. False if not.