[Home]Jekyl/Questions

Robo Home | Jekyl | Changes | Preferences | AllPages

Showing revision 4
I am trying to determine the angle of my bot relative to the angle of the enemy bot. What I am trying to determine is if I am heading directly at my target or directly away. I have tried a couple of different thigns with no success and I now suspect that I have looked at it so long that I can not see the obvious. I beleive that it should simply be a comparison between Enemy Bearing and getHeadingRadians() (assuming all radians in the measurement). To orbit I set me bearing to enemy bearing + PI. Works like a champ. But when I try to take the difference of these two angles, in situations where I know I am pointed directly at the enemy I am meeting with little success. So I put the question out there. I need this for a new wall smoothing algorithm I am working on which tends to move too much pointing directly at my enemy. I would like to be able to detect this and adjust accordingly. Thanks.

To orbit you want turnRight(e.getBearing()+PI/2); to tell if you are facing the enemy you want abs(relativeAngle(e.getBearing()))<10, i think. That would return true if you are within 10 degrees (it will work just as well if you use radians) of facing the enemy. -- Tango

Tango is mixing up some radians and degrees there, but whatever. Don't forget to add PI to your heading if you are going backward. -- Kawigi


Robo Home | Jekyl | Changes | Preferences | AllPages
Edit revision 4 of this page | View other revisions | View current revision
Edited December 13, 2003 20:23 EST by Sparafucil3 (diff)
Search: