I am currently developing an app that calculates the time difference (in seconds) between the driver in front and behind of the current player.
I know the total distance driven by all cars, same with the distance driven that lap, lap distance, speed and X and Y coordinates on the track. Click here for the full list of data
With this information, I can some how know the time from the other two cars. How would I do this mathematically?
As I am getting the data in real time, I only have to care about distance and speed.
By getting the distance driven of the car in front (e.g. FD = 100m) and the distance driven of the player (e.g PD = 50m) and the speed of the player speed (e.g. PS = 90m/s), I can then work out
difference = FD-PD = 50mtime delta = difference/PS = 50/90 = 0.5s.Due to the data arriving in real time, there may be a small error with acceleration, however, there is such small error that it gives me results I expect.