IStandardRobotPeer SetAdjustRadarForBodyTurn Method Robocode Robot API for .NET
Sets the radar to turn independent from the robot's turn.

Ok, so this needs some explanation: The radar is mounted on the gun, and the gun is mounted on the robot's body. So, normally, if the robot turns 90 degrees to the right, the gun turns, as does the radar. Hence, if the robot turns 90 degrees to the right, then the gun and radar will turn with it as the radar is mounted on top of the gun. To compensate for this, you can call IsAdjustRadarForBodyTurn(true). When this is set, the radar will turn independent from the robot's turn, i.e. the radar will compensate for the robot's turn.

Note: This method is additive until you reach the maximum the radar can turn. The "adjust" is added to the amount you set for turning the gun, then capped by the physics of the game. If you turn infinite, then the adjust is ignored (and hence overridden).

Examples

Assuming the robot, gun, and radar all start Out facing up (0 degrees):
// Set radar to turn with the robots's turn
SetAdjustRadarForBodyTurn(false); // This is the default
TurnRight(Math.PI / 2);
// At this point, the body, gun, and radar are all facing right (90 degrees);
// Set radar to turn independent from the robot's turn
SetAdjustRadarForBodyTurn(true);
TurnRight(Math.PI / 2);
// At this point, the robot and gun are facing right (90 degrees), but the radar is still facing up.
-- or --

Namespace: Robocode.RobotInterfaces.Peer
Assembly: robocode (in robocode.dll) Version: 1.9.2.0
Syntax

void SetAdjustRadarForBodyTurn(
	bool independent
)

Parameters

independent
Type: OnlineSystem Boolean
true if the radar must turn independent from the robots's turn; false if the radar must turn with the robot's turn.
See Also