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)
Print

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!

 


Contributors to this page: jacmoe133512 points  and Frozenrain .
Page last modified on Saturday 02 of January, 2010 07:51:27 UTC by jacmoe133512 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.