Lateral Velocity

From RoboWiki
Jump to: navigation, search

A bot's velocity in a direction perpendicular to the reference bot. For a bot moving exactly perpendicular to the reference bot, abs(velocity) would equal abs(lateral velocity), while for a bot moving directly toward or away from a reference bot, lateral velocity would be zero.

As a hypothetical example, let's imagine an enemy bot moving full speed at a 45 degree angle toward or away from the reference bot. From the reference bot's perspective, the actual lateral distance the enemy covers would be the same as if the enemy was moving perpendicular at half-speed. So, if the reference bot was using linear targeting, it would aim at a velocity of 4 (or -4 if the enemy was moving counter-clockwise), and (assuming the enemy moved in a straight line and didn't hit a wall), it would hit the enemy every time!

Lateral velocities are very commonly used in targeting algorithms, ranging from simple linear targeting to extremely complex guess factor guns.

Here is an example of how to calculate an enemy's lateral velocity:

public void onScannedRobot(ScannedRobotEvent e) {
    double enemyAbsoluteBearing = e.getBearingRadians() + getHeadingRadians();
    double enemyLateralVelocity = e.getVelocity() * Math.sin(e.getHeadingRadians() - enemyAbsoluteBearing);
}

In this example, a bot moving clockwise would have a positive lateral velocity, and a bot moving counter-clockwise would have a negative lateral velocity.

See Also

Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Can't contact the database server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (localhost))


You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.