diff options
Diffstat (limited to 'src/Camera.java')
-rw-r--r-- | src/Camera.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Camera.java b/src/Camera.java index fde3d80..f53abd7 100644 --- a/src/Camera.java +++ b/src/Camera.java @@ -155,7 +155,7 @@ class Camera { /** * First person mode: look from the slowest robot forward. */ - FocusPosition focus = smoothFocusTo(getSlowestRobot()); + FocusPosition focus = smoothFocusTo(getLastRobot()); // trivial: looks from the robot POV. eye = track.getPointForLane(focus.getTimePos(), focus.getLane()); @@ -221,6 +221,20 @@ class Camera { } return slowest; } + + /** + * Returns the robot which is placed last in the race. + */ + private Robot getLastRobot() { + Robot last = robots[0]; + + for (Robot robot : robots) { + if (robot.getPositionMeters() < last.getPositionMeters()) { + last = robot; + } + } + return last; + } /** * Time when the transition started; |