Game Development Community

Found bug in AIWheeledVehicle

by Bullitt Sesariza · in Torque Game Engine · 12/13/2007 (9:16 am) · 1 replies

Just recently found this when I traced my game.

This is my current path that go wrong.
img220.imageshack.us/img220/8220/patherrorto6.jpg
And when I looked at the method AIWheeledVehicle::getAIMove(), I found this
// Build move direction in world space
				if (isZero(xDiff))
					movePtr->y = (location.y > mMoveDestination.y)? -1 : 1;
				else
					if (isZero(yDiff))
					movePtr->x = (location.x > mMoveDestination.x)? -1 : 1;

With this code, because I made the path goes from a higher y to a lower one, it always returns true thus making the "movePtr->y" equals to -1 (a.k.a. moving backwards). But based on the orientation of the car (mine is facing towards the destination), it will make it further away from the destination. IMHO, the same goes to the code below it ("if(isZero(yDiff))"). Not that it matters though in my game cause I used the quick hack to make the "movePtr->y = 1" always (well, my car is always facing towards the destination anyhow). :D

Well, IMHO, I think the orientation of the car should be checked also in that code. I don't know how to, I'm afraid. It's 1 o'clock in the morning and I can't seem to think straight. :D

Hope this helps.

#1
12/13/2007 (9:25 am)
Haha, after looking at my thread's timestamp on this board, it looks like it's still midnight after all. It looks like I can't see straight also. Damn, these overtimes are killing me!