Bug with pathing
Jump to navigation
Jump to search
Revision as of 9 January 2013 at 18:39.
The highlighted comment was created in this revision.
The highlighted comment was created in this revision.
So, I have found a bug with Gilgalad's pathing where the path's coordinate is occasionally about 0.002 units from the correct coordinate. This is seems to happen only when switching from positive to negative velocity, but I think I handle the current rule for that correctly:
if (moveDir != Math.signum(currentVelocity)) {
if (currentVelocity > 2.0) {
currentVelocity -= 2.0;
} else if (currentVelocity < -2.0) {
currentVelocity += 2.0;
} else {
currentVelocity = moveDir
* (1.0 - Math.abs(currentVelocity) * 0.5);
}
}
On oddity I noticed is that I will have -0.0 for my velocity when moving from 2.0 to 0.0, but I don't think that would cause problems.
Perhaps my trig function is not exactly the same as that used by robocode and that causes the difference?
Thanks for any help.
AW
Well, the problem seems to occur more when the angle is near a multiple of PI. Any interesting quirks with sin() or cos() near those angles?
AW