title: How do i find if an object is before or after a waypoint?
body: <p>Im working on a racing game for a school project.
  Using Visual studio 10 pro, and Irrlicht.
  Sorry for bad grammar >.>, and its my first question so not sure if its done right.</p>
  
  <p>How i want it to work is that i make waypoints at different points on the track,
  and then i run my waypoint check to see if a car is past its next waypoint (the next it "needs" to go past), if yes then it updates the next waypoint, else nothing.</p>
  
  <p>The way i hope this will work is, i make a vector from n to n+1, then find the vector that is perpendicular to the first vector at n. Then i see if the object is in front or behind that vector.
  I found a <a href="http://www.gamedev.net/topic/542870-determine-which-side-of-a-line-a-point-is/" rel="nofollow">Gamedev.net forumpost</a> that helped me make this function:</p>
  
  <pre><code>void Engine::checkWaypoint(Vehicle* vehicle)
  {
    btVector3 vector = waypoints[vehicle-&gt;nextWaypoint];
    // n
    btVector3 nextVector = waypoints[vehicle-&gt;nextWaypoint + 1];
    // n+1
    vector = nextVector - vector;
    // First vector
    btVector3 pos = btVector3(vehicle-&gt;position.X,vehicle-&gt;position.Y,vehicle-&gt;position.Z);
  
    float product = vector.dot(pos - waypoints[vehicle-&gt;nextWaypoint]);
    // positiv = before, negative = behind
  
    if(product &lt; 0)
      vehicle-&gt;nextWaypoint += 1;
  }
  </code></pre>
  
  <p>Current bugs with this is:</p>
  
  <ol>
  <li><p>Updates the nextwaypoint more then ones without going past a new point.</p></li>
  <li><p>When it gets to the end and resets, it stops triggering on the first waypoints.</p></li>
  </ol>
  
  <p>So my questions:</p>
  
  <p>Is this an good way to do this?</p>
  
  <p>Did i do it right?</p>