Added tracking for angle between third person boat and next mark
#story[1195]
This commit is contained in:
@@ -27,9 +27,8 @@ import javafx.scene.transform.Translate;
|
||||
import javafx.util.Callback;
|
||||
import network.Messages.Enums.RaceStatusEnum;
|
||||
import shared.dataInput.RaceDataSource;
|
||||
import shared.model.CompoundMark;
|
||||
import shared.model.Leg;
|
||||
import shared.model.Mark;
|
||||
import shared.exceptions.BoatNotFoundException;
|
||||
import shared.model.*;
|
||||
import visualiser.app.App;
|
||||
import visualiser.enums.TutorialState;
|
||||
import visualiser.gameController.ControllerClient;
|
||||
@@ -304,6 +303,14 @@ public class RaceController extends Controller {
|
||||
// Fix initial bird's-eye position
|
||||
view3D.updatePivot(new Translate(250, 0, 210));
|
||||
|
||||
view3D.targetProperty().addListener((o, prev, curr)-> {
|
||||
if(curr != null && visualiserRace.getVisualiserRaceState().isVisualiserBoat(curr.getSourceID())) {
|
||||
addThirdPersonAnnotations(curr);
|
||||
} else {
|
||||
removeThirdPersonAnnotations();
|
||||
}
|
||||
});
|
||||
|
||||
// Bind zooming to scrolling
|
||||
view3D.setOnScroll(e -> {
|
||||
view3D.updateDistance(e.getDeltaY());
|
||||
@@ -349,6 +356,22 @@ public class RaceController extends Controller {
|
||||
});
|
||||
}
|
||||
|
||||
private void addThirdPersonAnnotations(Subject3D subject3D) {
|
||||
try {
|
||||
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
||||
boat.bearingProperty().addListener((o, prev, curr) -> {
|
||||
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
||||
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
||||
System.out.println(headingToMark.degrees() - boat.getBearing().degrees());
|
||||
});
|
||||
} catch (BoatNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeThirdPersonAnnotations() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap the colour of the next mark to pass with the last mark passed
|
||||
* @param leg boat has started on
|
||||
|
||||
Reference in New Issue
Block a user