partway through fixing boat movement to be updated from the data valid timestamp rather than the data sent timestamp #pair[kre39, ptg19] #story[820]

This commit is contained in:
Peter Galloway
2017-04-29 20:13:34 +12:00
committed by Peter
parent 1e1e482b79
commit a898290c0b
6 changed files with 166 additions and 35 deletions
+17 -15
View File
@@ -146,21 +146,23 @@ public class BoatGroup extends RaceObject{
}
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
destinationSet = true;
boat.setVelocity(StreamParser.boatSpeeds.get((long)boat.getId()));
if (hasRaceId(raceIds)) {
this.pixelVelocityX = (newXValue - boatPoly.getLayoutX()) / expectedUpdateInterval;
this.pixelVelocityY = (newYValue - boatPoly.getLayoutY()) / expectedUpdateInterval;
this.rotationalGoal = rotation;
calculateRotationalVelocity();
rotateTo(rotation);
if (wakeGenerationDelay > 0) {
wake.rotate(rotationalGoal);
wakeGenerationDelay--;
} else {
wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, pixelVelocityX, pixelVelocityY);
}
}
moveGroupBy(newXValue - boatPoly.getLayoutX(), newYValue - boatPoly.getLayoutY(), rotation);
// destinationSet = true;
// boat.setVelocity(StreamParser.boatSpeeds.get((long)boat.getId()));
// if (hasRaceId(raceIds)) {
// this.pixelVelocityX = (newXValue - boatPoly.getLayoutX()) / expectedUpdateInterval;
// this.pixelVelocityY = (newYValue - boatPoly.getLayoutY()) / expectedUpdateInterval;
// this.rotationalGoal = rotation;
// calculateRotationalVelocity();
// rotateTo(rotation);
// if (wakeGenerationDelay > 0) {
// wake.rotate(rotationalGoal);
// wakeGenerationDelay--;
// } else {
// wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, pixelVelocityX, pixelVelocityY);
// }
// }
}
public void setDestination (double newXValue, double newYValue, int... raceIDs) {