mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user