mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Fix for wakes on internal data
#bug
This commit is contained in:
@@ -214,18 +214,19 @@ public class BoatGroup extends RaceObject{
|
||||
pixelVelocityY = dy / expectedUpdateInterval;
|
||||
rotationalGoal = rotation;
|
||||
calculateRotationalVelocity();
|
||||
|
||||
if (wakeGenerationDelay > 0) {
|
||||
wake.rotate(rotationalGoal);
|
||||
rotateTo(rotationalGoal); //Need to test with this removed.
|
||||
rotationalVelocity = 0;
|
||||
wakeGenerationDelay--;
|
||||
} else {
|
||||
wake.setRotationalVelocity(rotationalVelocity, currentRotation, boat.getVelocity());
|
||||
wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, boat.getVelocity());
|
||||
}
|
||||
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
|
||||
} else {
|
||||
setToInitialLocation = true;
|
||||
rotationalGoal = rotation;;
|
||||
rotationalGoal = rotation;
|
||||
moveTo(newXValue, newYValue, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,15 @@ class Wake extends Group {
|
||||
void setRotationalVelocity (double rotationalVelocity, double rotationGoal, double velocity) {
|
||||
sum -= Math.abs(velocities[(velocityIndices[0] + 10) % 13]);
|
||||
sum += Math.abs(rotationalVelocity);
|
||||
// System.out.println("sum = " + sum);
|
||||
max = Math.max(max, rotationalVelocity);
|
||||
// System.out.println("max = " + max);
|
||||
if (sum < (max / 3))
|
||||
rotate (rotationGoal); //In relatively straight segments the wake snaps to match the boats current position.
|
||||
//This stops the wake from eventually becoming out of sync with the boat.
|
||||
if (Math.abs(rotationalVelocity) > 0.5) {
|
||||
//This accounts for rogue rotations that are greater than what would be realistic. Value is kinda rough.
|
||||
//Basically just for our internal mock.
|
||||
if (Math.abs(rotationalVelocity) > 0.05) {
|
||||
rotationalVelocity = 0;
|
||||
rotate(rotationGoal);
|
||||
}
|
||||
//Update the index of the array of recent velocities that each wake uses. Each wake is 3 velocities behind the
|
||||
//next smallest wake.
|
||||
|
||||
Reference in New Issue
Block a user