Robot IsAdjustRadarForGunTurn Property 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 gun, then capped by the physics of the game. If you turn infinite, then the adjust is ignored (and hence overridden).


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
// At this point, both the radar and gun are facing right (90 degrees);
// Set radar to turn independent from the gun's turn
// At this point, the gun is facing right (90 degrees), but the radar is still facing up.
-- or -- Note: Calling IsAdjustRadarForGunTurn will automatically call IsAdjustRadarForRobotTurn with the same value, unless you have already called it earlier. This behavior is primarily for backward compatibility with older Robocode robots.

Namespace: Robocode
Assembly: robocode (in robocode.dll) Version:

public bool IsAdjustRadarForGunTurn { get; set; }

Property Value

Type: OnlineBoolean
See Also