[Home]PerpendicularMovement

Robo Home | Changes | Preferences | AllPages

Showing revision 4
This is where you try to keep e.getBearing() in the ScannedRobotEvent at a right angle. That is, your heading is 90 degrees (or PI/2 radians) away from the direction towards the other bot.

Usually, but not entirely necessarily, practiced by Oscillators

Also practiced by bots that circle around the enemy, as in the Saturn series of bots - Iapetus?, Titan?, Calypso?, Pandora - check http://www.nineplanets.org to see where those names come from :-)

Used by very many bots because it gives easier opportunity for Dodging?.

Very boring movement style, but effective.

A variation is found in the FluidMovement implemented in Neptune, where you try to stay as perpendicular as possible to everything that matters: enemy bots, walls, enemy bullets (ShrapnelDodging). Kind of like toothpaste in a tube behaves when you squeeze it onto a toothbrush.

--tobe

Does anyone have a good method that keeps your bot at a set distance from another bot with BackAsFront? -- KID

You can use something like this. It is a bit rigid because it always uses the same angle (roughly 60 degrees) to get to its preferred distance, but you can always change it to your needs.

diveAngle = Utils.normalRelativeAngle(enemy.getBearing() + Math.PI/2);
defTurnAngle = Math.atan(Math.tan(diveAngle));
distDiff = enemy.getDistance() - DEFDISTANCE;  // DEFDISTANCE is preferred distance
adjustAngle = (diveAngle == defTurnAngle ? currDirection : -currDirection);
if (distDiff < 0) {
       adjustAngle *= 1;
   }
   else {
       adjustAngle *= -1;
   }
}
setTurnRightRadians(defTurnAngle + adjustAngle);
I use currDirection to go forwards or backwards, because I do not use negative distances. This is not the same as direction in BackAsFront ! -- GrubbmGait


Robo Home | Changes | Preferences | AllPages
Edit revision 4 of this page | View other revisions | View current revision
Edited September 28, 2005 10:53 EST by GrubbmGait (diff)
Search: