OWSimpleRaycastWheel
- 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.
Properties
Public Properties
float
The radius of the wheel.
float
The lenght which the suspension considers to be at rest.
float
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.
float
The spring constant of the suspension.
float
The damping constant of the suspension.
Usually make it smaller then the springStiffness to have better results.
float
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.
float
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.
float
The target angle (in degrees) which you want the wheel to be at.
float
The 'time' that the wheel will take to reach the target angle in steerAngle.
Bigger values make it reach the end value faster.
Rigidbody
The Rigidbody the wheel will use to apply the forces it calculates.
LayerMask
The LayerMask it will use on the raycast to be considered as valid ground.
Methods
Public Methods
bool
IsOnGround()
Returns true if the wheel is hitting a valid ground. False if not.