How to drive a car         You have a car, you have a point (i.e. waypoint), but you don't know how to determine side car should turn to drive to point(left or right)

Problem

You have a car and you have a point (i.e. waypoint), but you don't know how to determine to which side the car should turn to drive to the point (left or right).

Solution

Your first thought might be that solving this requires some math. But we like neither math nor magical formulas. Luckily, there is a clean, easy and simple solution. Just look at the picture:

HowToDriveCar.jpg

Left Node and Right Node are children of the car node, placed on the same distance at the left and right of the car. I.e. if the car is initially oriented along (0,0,1), left node would be (-1,0,0) and right one (1,0,0). What is the solution? Just take side which node is closer to the waypoint. No math formulas!