diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-12-23 12:43:08 +0100 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-12-23 12:43:08 +0100 |
commit | cafd122ab2ad90160a9a1f75917f1e03677fa861 (patch) | |
tree | 4bc0875c19d02493b3cd1d336e94210b5b90b1d5 /src/RobotRace.java | |
parent | cbfd16060e8352d7ea8f05d9bb8d58253243930d (diff) | |
download | 2iv60-robots-cafd122ab2ad90160a9a1f75917f1e03677fa861.tar.gz |
Fix FP view eye point, whitespace fixes.
Diffstat (limited to 'src/RobotRace.java')
-rw-r--r-- | src/RobotRace.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java index ee7fbcc..b3f28d0 100644 --- a/src/RobotRace.java +++ b/src/RobotRace.java @@ -378,11 +378,6 @@ public class RobotRace extends Base { // to 0 means robot is matching expected and great means that // we have a turtle. double jitter = current_t - robot.getTimePos(); - - - - - // TODO: do not use static speed robot.setSpeed(TARGET_ROBOT_SPEED); } @@ -413,18 +408,18 @@ public class RobotRace extends Base { // put robot centered on the lane, slightly rotated to look forward Vector robotPos = raceTrack.getPointForLane(robot.getTimePos(), i); gl.glTranslated(robotPos.x(), robotPos.y(), robotPos.z()); - + /* Calculate angle for the robots to look at, multiply by 180/PI * to convert the radions to degrees. * First get the tangent of the robot, that is the real direction - * where the robot is looking to. - * Then add this vector to the actual position, and from the + * where the robot is looking to. + * Then add this vector to the actual position, and from the * resulting vector we can calculate the angle. */ Vector robotTangent = raceTrack.getTangent(robot.getTimePos()); Vector totalVector = robotTangent.add(robotPos); - + double angle = atan2(totalVector.y(), totalVector.x()) * 180/PI; - + gl.glRotated(angle, 0, 0, 1); // Draw the current robot |