Hi all,
Using A*, I have an object that is following a list of points.
Because the object's speed and actual path is somewhat variable (it only follows the general vicinity of the points), I am looking for a good way to determine if it has passed one point and should move on to the next.
I thought I could do this with the dot product, to check the old vector toward the point with the new one, like so:
oldVector=objectTravelVector;
objectTravelVector=chasingPoint-objectPoint;
objectTravelVector.Normalize();
if (oldVector.Dot(objectTravelVector)<0) // Move to next point
It seems like that should work, but I am getting instances of my object circling points and refusing to move on to the next one. It seems that if I pass the point, my dot product with the previous vector should be negative, and I just say, okay, next, point.
Am I doing this wrong?