RiddleTime / Race-Element

Solutions for Sim Racing
https://race.elementfuture.com
GNU General Public License v3.0
77 stars 17 forks source link

Position prediction for pit stop exit and lapped cars logic #178

Closed iFuSiiOnzZ closed 3 months ago

iFuSiiOnzZ commented 3 months ago

Feature

Pit stop algorithm

pitStopTotalTime = pitStopTime + (pitLaneTime % EstimatedLapTime)
trackTime = currentLapTime - pitStopTotalTime

if (trackTime < 0)
{
    trackTime += EstimatedLapTime;
}

trackNormalizedPos = trackTime / EstimatedLapTime
trackPosIndex = trackNormalizedPos * trackMappedPoints;

PointF pos = trackMappedPoints[trackPosIndex] <-- Where the car should end on track
int laps = pitStopTotalTime / BestTimeMs      <-- Number of laps needed to fix the car