I need to use Wheel Colliders, and I need to detect for Slip. This is pretty easy with the slip property, but does anyone know what the unit of the returned value is? Even better, does anyone know a range so I can convert this to a percentage slip?
It is between 0 and 1. For instance, this code copied from the docs:
// Prints "braking slip!" when tire slips badly.
function FixedUpdate() {
var hit : WheelHit;
var wheel : WheelCollider = GetComponent(WheelCollider);
if( wheel.GetGroundHit( hit ) ) {
if( hit.forwardSlip > 0.5 ) {
print ("braking slip!");
}
}
}
Checks if the slip is 0.5, suggesting a return value with a range from -1 to 1, because acceleration slip is returned as a negative value, while braking slip is positive. This should be pretty easy to convert to a percentage, unless you don't like the negative return value for forward slip.