0 votes
by
We need to add a "Drift Score System“. Where to get these values?

1 Answer

0 votes
by
 
Best answer

Vehicles expose two properties you can use:

  • vehicle.speed: absolute vehicle speed (m/s)
  • vehicle.speedAngle: angle of the front of the car with respect to the velocity vector (degrees)

When speed is above a certain value you may check out speedAngle to realize whether the car is drifting or not. For example:

bool isDrifting = vehicle.speed > 5.5f && Mathf.Abs(vehicle.speedAngle) > 25.0f;

That means: when the car is moving above 20 km/h (~5.5 m/s) and the angle with the speed is more than 25 degrees, then the car is drifting. Modify these values to your convenience.

Reference: Properties exposed in the vehicle controller

...