View Full Version : Getting start lane position and orientation

11-07-2018, 12:01

Is there any way of getting current track start position and orientation? (to draw it in a map)

11-07-2018, 12:37
You could google the tracks and look for the start line and get the direction bearing /..
Do you mean in a data dump ? UDP data and track orientation to capture for an app ?
Or do you want a visual track map, with where you are? Exported file ?
Do you mean in the replay file ?
or whilst your driving (track map) -in the UI ?

Not quite sure what your actually asking for ... you want the position and direction (im assuming of your car).. if you want it for each track, im assuming the UDP data would have it.. but if you just need for a map, might be quicker to just use google.

Your question isnt very clear, so hard to answer. (What exactly do you want ?

12-07-2018, 07:07
You are right, my question sucks sorry...

I'm using UDP api, I just want to get the position and orientation of the track start related to the "world position" (sent in "eTimings" or in "eCarPhysics") and orientation (sent on "eTimings"), that way I can calculate when did the player pass through the start position

12-07-2018, 09:15
Cheers ;) I honestly know zero in this area :) so cant help, however theres many who can, hopefully they can offer up the info you need :)

12-07-2018, 09:20
There are a couple of workarounds I thought:
1- Take the initial position and heading of the car as start position - very easy to implement, but not very accurate
2- Wait for the first lap to be completed (current lap time = 0) and use it as start position - harder to implement, have to wait for first lap (not a problem since I draw the circuit layout during this first lap), but accurate (the position, the heading can be wrong)

13-07-2018, 10:30
Why not get the coords of a car when its sCurrentLapDistance wraps around to 0? Or actually, when it changes say from over 95% distance to under %5 distance to take into account your sampling frequency.

Edit: Just reread your question and if you only want to know the moment a car passes the start/finish line, forget about getting the coords :)

13-07-2018, 10:43
actually that's also a good idea

just to clarify what i want to do:

currently i have a GPS based app to measure lap times and show some in-race telemetry and drive aids in real life (yeah, i also race in real life):
(Cannot post videos for being a n00b) => youtube watch?v=G4qWM_Kcdi4

And I want to implement a "mock" GPS to be able to use it also with PC2 (mostly for testing and debugging). In real life, I set the track start and orientation using google maps (and finish line if is not a looped track), and work from there... but in PC2 i dont have the start position right away.

Anyway, thanks a lot for your help, is always great to have quality feedback

13-07-2018, 13:54
Ok. Then the easiest way I guess is to go to sCurrentLapDistance=0, face perpendicular to the start line, and have your app save the position (sFullPosition) and orientation (sOrientation) on disk. Rinse and repeat for each track.

13-07-2018, 14:10
Thanks! If it works properly probably I will leave it in the app as a free demo and charge for use it in real racing

14-07-2018, 16:16
But I still think that in the sim you'd better use a different method, what I am doing is to check the sector before and after, if it has changed from 3 to 1, then the car just crossed the finish line, it is very simple. In real life, you do not have information like that, so you had to use a smart algorithm with the GPS coordinates to calculate when you pass the finish line, but in game we do have all this info already calculated for us, ready to use :)

16-07-2018, 06:29
yep, it would be easier using that information already calculated, but the main reason for implementing it is to validate my own calculations via GPS for the real life, I already have implemented the algorithm that given the start position and orientation and the list of GPS positions of the driver, calculates the time he crossed the start line (taking the GPS position before the line, the GPS position after the line, the distance and timestamp for both to calculate the "virtual" timestamp when he actually was crossing the line).

i will use the lap time the API gives to compare it with the one i got to help me improve my calculations (in real life, is accurate up to the tenth of a second)