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

Ok, so this needs some explanation: The radar is mounted on the robot's gun. So, normally, if the gun turns 90 degrees to the right, then the radar will turn with it as it is mounted on top of the gun. To compensate for this, you can call IsAdjustRadarForGunTurn(true). When this is set, the radar will turn independent from the robot's turn, i.e. the radar will compensate for the gun'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 robot, then capped by the physics of the game. If you turn infinite, then the adjust is ignored (and hence overridden).

Examples

Assuming both the gun and radar start Out facing up (0 degrees):
// Set radar to turn with the gun's turn
SetAdjustRadarForGunTurn(false); // This is the default
TurnGunRight(Math.PI / 2);
// At this point, both the radar and gun are facing right (90 degrees);
// Set radar to turn independent from the gun's turn
SetAdjustRadarForGunTurn(true);
TurnGunRight(Math.PI / 2);
// At this point, the gun is facing right (90 degrees), but the radar is still facing up.
-- or -- Note: Calling IsAdjustRadarForGunTurn(bool) will automatically call SetAdjustRadarForBodyTurn(Boolean) with the same value, unless you have already called it earlier. This behavior is primarily for backward compatibility with older Robocode robots.

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

void SetAdjustRadarForGunTurn(
	bool independent
)

Parameters

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