Apps How to get correct driven distance in python apps, taking into account jumping behind the start/finish line in "back to pits"?

I'm doing yet another leaderboard-gap-distance, etc. app, and I'm collecting all kinds of data of car's position on track and distance/time history etc.

In general, just doing ac.getCarState(carID, acsys.CS.LapCount) + ac.getCarState(carID, acsys.CS.NormalizedSplinePosition)
gives a nice number that denotes the distance the car has driven in the race. However, this doesn't work if the car jumps back to pits and their pit box is behind the starting line: If the car driven 2 laps and is currently in spline position 0.20, and jump back to their pit box which is at spline position 0.99, the lap count remains the same and it looks like they have jumped forward in the track while they have actually jumped backward.

Now I could of crouse try to detect sudden jumps and keep track of the corrections, but it is an ugly hack and sounds like a recipe for disasters in some edge cases or connection problems in online races.

Is there any way in the API to distinguish between "Car has driven 2 laps and 99 % of the current lap and is about to finish the 3rd lap" and "Car has driven 2 laps and is currently 1 % behind the starting line but is not about to finish the 3rd lap". ? I can't find an answer in either the Python API doc or the shared memory doc.
 
Last edited:

Latest News

To join the OverTake Racing Club races I want them to be: (multiple choice)

  • Free to access

    Votes: 144 86.2%
  • Better structured events

    Votes: 27 16.2%
  • Better structured racing club forum

    Votes: 25 15.0%
  • More use of default game content

    Votes: 21 12.6%
  • More use of fixed setups

    Votes: 50 29.9%
  • No 3rd party registration pages

    Votes: 58 34.7%
  • Less casual events

    Votes: 15 9.0%
  • More casual events

    Votes: 55 32.9%
  • Other, specify in thread

    Votes: 10 6.0%
Back
Top