By Lawrence
15 minutes
15 minutes
Road Projection
This lesson starts from the lab, with every edit from lessons 1 and 2 undone.
World space and road space
The car stores its position as world x and z. The road works in road space, which lesson 1.7 used for the traffic: s, how far along the road, and u, how far across it. Lane 1, a shoulder, a bridge deck: each of those is a question about s and u. So every lane check first turns the car's x, z into s, u.
On the straight start, that is free: s is z and u is x. On a bend it is not. The line straight across the road from the car meets the centre line a little ahead of the car, or a little behind it, not level with it.

Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.
$5one-time
=