summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-12-20 11:45:47 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-12-20 11:45:47 +0100
commit77290dbb617fc33e0d6eb9287279d79eff85b7ad (patch)
tree9cda079b2b1ba4f72d92a51fe3582bf1609a152f
parent3ab8042ed072d34aee3e270f3aa4fcb053939ee5 (diff)
download2iv60-robots-77290dbb617fc33e0d6eb9287279d79eff85b7ad.tar.gz
Fix eye point for helicopter view, center robots on lane
-rw-r--r--src/Camera.java4
-rw-r--r--src/RobotRace.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/Camera.java b/src/Camera.java
index fd29482..1db6f37 100644
--- a/src/Camera.java
+++ b/src/Camera.java
@@ -110,6 +110,8 @@ class Camera {
for (Robot robot : robots) {
time_sum += robot.getTimePos();
}
+ // for now stay in the middle of the robots, later we could follow the
+ // fastest (or slowest) robot if desired.
double time_avg = time_sum / robots.length;
// center at the center lane
@@ -119,7 +121,7 @@ class Camera {
up = track.getTangent(time_avg);
// "above" is 10 meters.
- eye = center.add(new Vector(center.x(), center.y(), 10f));
+ eye = center.add(new Vector(0, 0, 10f));
}
/**
diff --git a/src/RobotRace.java b/src/RobotRace.java
index aeddfba..2aadc63 100644
--- a/src/RobotRace.java
+++ b/src/RobotRace.java
@@ -409,8 +409,8 @@ public class RobotRace extends Base {
gl.glPushMatrix();
Robot robot = robots[i];
- // put robot on the lane, slightly rotated to look "forward"
- Vector robotPos = raceTrack.getPointForLane(robot.getTimePos(), i);
+ // put robot centered on the lane, slightly rotated to look forward
+ Vector robotPos = raceTrack.getPointForLane(robot.getTimePos(), i + .5);
gl.glTranslated(robotPos.x(), robotPos.y(), robotPos.z());
// FIXME: robot looks in wrong direction.
double angle = atan2(robotPos.y(), robotPos.x());