Commit before checking out developement
This commit is contained in:
@@ -323,8 +323,19 @@ public class RaceViewController extends Controller {
|
|||||||
AnimationTimer sailsFollowBoat = new AnimationTimer() {
|
AnimationTimer sailsFollowBoat = new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
|
double windDir = visualiserRace.getVisualiserRaceState().getWindDirection().degrees();
|
||||||
|
double windOffset = (360 - windDir + boat.getBearing().degrees()) % 360;
|
||||||
|
double sailDir = windOffset / 180 * 270 + windDir + 180;
|
||||||
|
boolean leftOfWind = windOffset >= 180;
|
||||||
|
if (leftOfWind){
|
||||||
|
System.out.println("is left");
|
||||||
|
sailDir = -sailDir;
|
||||||
|
} else {
|
||||||
|
System.out.println("is right");
|
||||||
|
sailDir = windDir - sailDir;
|
||||||
|
}
|
||||||
if (boat.isSailsOut()) {
|
if (boat.isSailsOut()) {
|
||||||
sailsSubject.setHeading(visualiserRace.getVisualiserRaceState().getWindDirection().degrees() + 90);
|
sailsSubject.setHeading(sailDir);
|
||||||
if (sails3D.isLuffing()) {
|
if (sails3D.isLuffing()) {
|
||||||
sails3D.stopLuffing();
|
sails3D.stopLuffing();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user