The navigation system provides information about the bot's position and controls its movement.
The positions of objects on the battlefield are specified using a 3-D (X, Y, Z) coordinate system,
and are measured in meters. A vector represents an exact position, a set of X, Y, and Z
coordinates, each of which is represented as a floating point value. The origin is in the center of
the battlefield at ground level, vector (0, 0, 0). The X axis runs West to East, the Y axis runs
upward where 0 is ground level, and the Z axis runs South to North. For example, if you're at
vector (5, 0, -1.5), you're 5 meters east of the origin (X = 5), on the ground (Y = 0), and 1.5 meters
south of the origin (Z = -1.5).
A bot will move slower if it's navigation system is damaged.
Use the Nav property of your AI class to access the navigation system.
Methods that move the bot, such as Move or Turn, will throw a CollisionException if the bot hits
anything while trying to move. Therefore, your code should always use a try...catch block to
handle this situation; otherwise, if your bot hits something, this unhandled exception will cause
your AI program to end.
(Note that a bot can't destroy an object by running into it. Only a weapon can destroy an object.)
Here are some isolated examples:
Nav.Move(MoveDirection.Forward, 3); // move forward 3 meters
Nav.MoveTo(10, 5); // move to vector (10, 0, 5)
Nav.Turn(-45f); // turn left 45 degrees
Nav.TurnTo(90f); // turn to face East
Vector position = Nav.Position; // get current position
float x = Nav.Position.X; // get current X coordinate
float heading = Nav.Heading; // get current heading
float distance = Nav.GetDistance(15, 0, 20); // get distance
to vector (15, 0, 20)
Recommended Topics