Rise
The Vieneo Province
Loading...
Searching...
No Matches
GroundTireGrip.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4
6{
7 // Both budgets are velocity changes for this frame (km/s), already limited by
8 // normal load and elapsed time. Static grip can cancel the complete demand;
9 // once that budget is exceeded, use sliding friction without reversing motion.
10 inline float ResolveLateralVelocity(float velocityKms, float staticDeltaVKms, float kineticDeltaVKms)
11 {
12 const float speedKms = std::fabs(velocityKms);
13 if (staticDeltaVKms > 0.0f && speedKms <= staticDeltaVKms)
14 return 0.0f;
15 if (kineticDeltaVKms <= 0.0f)
16 return velocityKms;
17 if (speedKms <= kineticDeltaVKms)
18 return 0.0f;
19 return std::copysign(speedKms - kineticDeltaVKms, velocityKms);
20 }
21}
float ResolveLateralVelocity(float velocityKms, float staticDeltaVKms, float kineticDeltaVKms)