Wakes still broken. Implemented dashed lines that track the progress of individual boats.

#implement #story[483]
This commit is contained in:
Calum
2017-04-27 13:57:19 +12:00
parent 65c0e6f77d
commit 67a702ffcd
7 changed files with 105 additions and 63 deletions
+13 -1
View File
@@ -9,7 +9,7 @@ import javafx.scene.Group;
public abstract class RaceObject extends Group {
//Time between sections of race - Should be changed to 200 for actual program.
protected static double expectedUpdateInterval = 2000;
protected static double expectedUpdateInterval = 200;
protected double rotationalGoal;
protected double currentRotation;
@@ -33,6 +33,18 @@ public abstract class RaceObject extends Group {
RaceObject.expectedUpdateInterval = expectedUpdateInterval;
}
protected void calculateRotationalVelocity () {
if (Math.abs(rotationalGoal - currentRotation) > 180) {
if (rotationalGoal - currentRotation >= 0) {
this.rotationalVelocity = ((rotationalGoal - currentRotation) - 360) / expectedUpdateInterval;
} else {
this.rotationalVelocity = (360 + (rotationalGoal - currentRotation)) / expectedUpdateInterval;
}
} else {
this.rotationalVelocity = (rotationalGoal - currentRotation) / expectedUpdateInterval;
}
}
public abstract void setDestination (double x, double y, double rotation, int... raceIds);
public abstract void setDestination (double x, double y, int... raceIds);