1)In order to generate slipping sounds, I need to know when a vehicle actually slip.
I would need a threshold applied on these functions, but I don’t know how to compute it.
In other words, I need to transform their analog values into booleans (ie slipping or not)
2)I noticed that when a vehicle slips, the brake is triggered, how can I disable this behaviour please ?
Thanks in advance.
There are two types of tire slip: lateral and longitudinal. If you are using 3.3 then these are reported in PxWheelQueryResult::lateralSlip and PxWheelQueryResult::longitudinalSlip. In earlier versions there are accessors to return these values per wheel.
The vehicle sdk decomposes the rigid body velocity at each wheel contact point into forward and lateral directions tire directions. This produces two speeds lateralSpeed and LongitudinalSpeed in the contact plane. The longitdunal slip is the difference between the speed of the spinning wheel at the contact point and LongitudinalSpeed . The normalised longitudinal slip is a more useful property
longSlip = (wheelRotationSpeed*wheelRadius - LongitudinalSpeed )/LongitudinalSpeed
When the wheel is locked by the brake (wheelRotationSpeed=0) we have longSlip = -1, when the car is freely rolling (wheelRotationSpeed*wheelRadius = vLongitudinal) we have longSlip = 0. and when the wheel is spinning faster than the car we have longSlip in range (0, infinity). There is special logic in the code to avoid divide-by-zero but that doesn’t really affect it too much.
The lateral slip is
lateralSlip = atan(lateralSpeed/|longitudinalSpeed|
When the tire has zero lateral speed we have zero lateral slip, while the lateral slip grows with the ratio of lateral and longitudinal speeds in range (-infinity, infinity).
As you can see, there isn’t a threshold at which any tire could be said to be “slipping” because it is a continuous process. The timestep also has a profound affect on the slip values, making it hard to set a specific threshold. I would recommend setting up the telemetry graphs so that you can drive your car around your map. This should give you an idea of the kinds of slip values being generated by your car in your application. An alternative would be to experiment with threshold values and tune them until you hear audio effects as you expect them.
The brake is definitely not triggered when tires start slipping. Could you please explain a bit more what you are experiencing?
Thank you very much for your detailed explanation about lateral et longitudinal slips. It’s really helpful.
Indeed, the brake is not triggered when tire slip, it’s a bug in my implementation (where the same keys can accelerate or brake, according to the vehicle move. (For example up pressed and moving forward=accelerate, and down pressed and moving forward=brake) )