Wake calculation now changed to be based off of the separation between wakes.

This allows wakes to auto correct their position better and stops the system reliance on "realistic data".
Wakes have several options for behaviour until the ideal settings are decided upon.
Note that MarkGroup position updating is currently disabled.

#implement #refactor #issue[1] #story[923]
This commit is contained in:
Calum
2017-05-14 17:24:15 +12:00
parent 711f6f4c45
commit 89ef6e5277
4 changed files with 158 additions and 84 deletions
+11 -13
View File
@@ -204,25 +204,23 @@ public class BoatGroup extends RaceObject{
double dx = newXValue - boatPoly.getLayoutX();
double dy = newYValue - boatPoly.getLayoutY();
//Check movement is reasonable. Assumes a 1000 * 1000 canvas
if (Math.abs(dx) > 50 || Math.abs(dy) > 50) {
dx = 0;
dy = 0;
moveTo(newXValue, newYValue);
}
// if (Math.abs(dx) > 50 || Math.abs(dy) > 50) {
// dx = 0;
// dy = 0;
// moveTo(newXValue, newYValue);
// }
pixelVelocityX = dx / expectedUpdateInterval;
pixelVelocityY = dy / expectedUpdateInterval;
rotationalGoal = rotation;
calculateRotationalVelocity();
if (wakeGenerationDelay > 0) {
wake.rotate(rotationalGoal);
rotateTo(rotationalGoal); //Need to test with this removed.
if (Math.abs(rotationalVelocity) > 0.075) {
System.out.println("rotationalVelocity = " + rotationalVelocity);
rotationalVelocity = 0;
wakeGenerationDelay--;
} else {
wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, boat.getVelocity());
rotateTo(rotationalGoal);
wake.rotate(rotationalGoal);
}
wake.setRotationalVelocity(rotationalVelocity, boat.getVelocity());
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
} else {
setToInitialLocation = true;
@@ -347,7 +345,7 @@ public class BoatGroup extends RaceObject{
App.start() -> Controller.setContentPane -> RaceViewController -> CanvasController
*/
this.stage = stage;
this.stage.iconifiedProperty().addListener(e -> {
this.stage.iconifiedProperty().addListener( e -> {
isMaximized = !stage.isIconified();
if (!lineStorage.isEmpty()) {
lineGroup.getChildren().addAll(lineStorage);