Start race in third person by default
- Third person zoom limit has been lowered - Next mark highlighting and arrow only follows player boat
This commit is contained in:
@@ -387,11 +387,27 @@ public class RaceViewController extends Controller {
|
||||
viewSubjects.add(markModel);
|
||||
}
|
||||
|
||||
for (VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
||||
// Position and add each boat to view
|
||||
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
||||
Shape3D mesh = Assets3D.getBoat();
|
||||
|
||||
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
||||
//mesh.setMaterial(boatColorMat);
|
||||
Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
|
||||
|
||||
// Configure visualiser for client's boat
|
||||
if (boat.isClientBoat()) {
|
||||
// Add player boat highlight
|
||||
Shockwave boatHighlight = new Shockwave(10);
|
||||
boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
||||
viewSubjects.add(boatHighlight);
|
||||
|
||||
// Track player boat with camera
|
||||
viewSubjects.add(boatModel);
|
||||
view3D.trackSubject(boatModel);
|
||||
view3D.setThirdPerson();
|
||||
|
||||
// Track player boat with highlight
|
||||
AnimationTimer highlightTrack = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
@@ -400,24 +416,18 @@ public class RaceViewController extends Controller {
|
||||
}
|
||||
};
|
||||
highlightTrack.start();
|
||||
|
||||
// Highlight next mark only for player boat
|
||||
Material markColor = new PhongMaterial(new Color(0.15,0.9,0.2,1));
|
||||
CompoundMark nextMark = boat.getCurrentLeg().getEndCompoundMark();
|
||||
view3D.getShape(nextMark.getMark1().getSourceID()).getMesh().setMaterial(markColor);
|
||||
if(nextMark.getMark2() != null) {
|
||||
view3D.getShape(nextMark.getMark2().getSourceID()).getMesh().setMaterial(markColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Position and add each boat to view
|
||||
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
||||
// MeshView mesh;
|
||||
// if(boat.getSourceID() == race.getVisualiserRaceState().getPlayerBoatID()) {
|
||||
// mesh = new MeshView(importer.getImport());
|
||||
// } else {
|
||||
// mesh = new MeshView(importerBurgerBoat.getImport());
|
||||
// }
|
||||
Shape3D mesh = Assets3D.getBoat();
|
||||
|
||||
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
||||
//mesh.setMaterial(boatColorMat);
|
||||
Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
|
||||
|
||||
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
||||
} else {
|
||||
viewSubjects.add(boatModel);
|
||||
}
|
||||
|
||||
//add sail
|
||||
Sails3D sails3D = new Sails3D();
|
||||
@@ -502,17 +512,9 @@ public class RaceViewController extends Controller {
|
||||
};
|
||||
trackBoat.start();
|
||||
|
||||
Material markColor = new PhongMaterial(new Color(0.15,0.9,0.2,1));
|
||||
CompoundMark nextMark = boat.getCurrentLeg().getEndCompoundMark();
|
||||
view3D.getShape(nextMark.getMark1().getSourceID()).getMesh().setMaterial(markColor);
|
||||
if(nextMark.getMark2() != null) {
|
||||
view3D.getShape(nextMark.getMark2().getSourceID()).getMesh().setMaterial(markColor);
|
||||
}
|
||||
Subject3D shockwave = new Shockwave(10);
|
||||
|
||||
viewSubjects.add(shockwave);
|
||||
|
||||
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
||||
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
||||
}
|
||||
// Fix initial bird's-eye position
|
||||
|
||||
@@ -81,7 +81,7 @@ public class View3D extends Pane {
|
||||
/**
|
||||
* Distance to stop zoom
|
||||
*/
|
||||
private final double ZOOM_IN_LIMIT = 30;
|
||||
private final double ZOOM_IN_LIMIT = 3;
|
||||
private final double ZOOM_OUT_LIMIT = 700;
|
||||
private final double MAX_ZOOM_LIMIT = 1500;
|
||||
private final double MAX_PITCH = 60; // birds eye view
|
||||
|
||||
Reference in New Issue
Block a user