|Home||You need enough timelines to make sure the cars go fully around the circuit.|
WHAT ARE TIMELINES?
Timelines are checkpoints, lines drawn from one point on the track to another (mostly perpendicular to the track's direction), making a line that must be crossed by the car for time measurement.
MINIMAL REQUIREMENTS FOR A TRACK
There should always minimally be 1 start/finish timeline, namely timeline #0, and another line at the other end of the track. If not, the driver can turn around after just crossing start/finish, pass through the one and only timeline again, and score a record time. This is avoided by placing enough timelines along the track so the fastest way around the track is most probably the way through the timelines.
HOW CAN I CREATE THEM?
Creating timelines is easy. Just load the track in TrackEd, go near the point where you want a timeline, draw a line using the left mouse button. Then, click 'Declare timeline' and enter an index. Note that the order of the timelines is important! Your car must sequentially move through all the timelines in the indexed order. If not, your lap will not count.
HOW DO THEY WORK?
Here's a graphical explanation of a timeline functionality:
|The left yellow dot indicates the one location, the right yellow dot is the other location (you can draw these lines in TrackEd). The spheres (they're not circles, but spheres in 3D actually) are just large enough to touch the other point. The area marked red is the intersection of both spheres, in which the car may pass through the green line between the two endpoints.|
It doesn't matter which direction the line has; it's the line itself that counts. When a car is driving near one of the two endpoints (indicated by their bounding sphere), Racer checks for being inside the red area (being inside both bounding spheres). If the car is indeed in the red area, a potential crossing of the line is present. The timeline actually has another property, namely a plane that goes through both endpoints, and points right up the sky (so don't make a timeline in a looping!). If the car's timing point (often the center of the nose) crosses that plane, then the timeline is crossed.
This makes for an reasonably efficient time crossing method (as we always at most have to test 1 timeline per integration step), and this is what Racer uses.
There are alternatives to this system, and good ones. Since v0.4.6, I started using splines to represent (most) parts of the track. A big plus for this is that the road becomes smoother (the polygons themselves are too hard to drive on using the senstive physics). A second plus is that you calculate intersections into the spline patch, and this gets you a u/v pair; 'u' representing lateral and 'v' representing longitudinal.
The 'v' value is interesting for the timing as well; it actually gives your longitudinal position on the track. It moves from 0 to about the tracklength. So you can basically define a 'crossing' v value. If the car passes this value, you just crossed the timeline.
(last updated November 13, 2012 )