The boat is now viewable in top down view (60 degrees for isometric) and the race is playable #story[1261]
This commit is contained in:
@@ -33,6 +33,9 @@ public class Subject3D {
|
||||
this.heading = new Rotate(0, Rotate.Y_AXIS);
|
||||
|
||||
this.mesh.getTransforms().addAll(position, heading, new Rotate(90, Rotate.X_AXIS), new Rotate(180, Rotate.Y_AXIS));
|
||||
this.position.xProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat x: " + newValue)));
|
||||
this.position.yProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat y: " + newValue)));
|
||||
this.position.zProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat z: " + newValue)));
|
||||
}
|
||||
|
||||
public Shape3D getMesh() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package visualiser.layout;
|
||||
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.geometry.Point3D;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.PerspectiveCamera;
|
||||
import javafx.scene.SubScene;
|
||||
@@ -77,7 +78,7 @@ public class View3D extends Pane {
|
||||
|
||||
// Set up view frustum
|
||||
nearClip = 0.1;
|
||||
farClip = 1000.0;
|
||||
farClip = 3000.0;
|
||||
camera.setNearClip(nearClip);
|
||||
camera.setFarClip(farClip);
|
||||
|
||||
@@ -87,7 +88,7 @@ public class View3D extends Pane {
|
||||
yaw = new Rotate(0, Rotate.Y_AXIS);
|
||||
pitch = new Rotate(0, Rotate.X_AXIS);
|
||||
camera.getTransforms().addAll(pivot, yaw, pitch, distance);
|
||||
//camera.setTranslateZ(-1000);
|
||||
centerCamera();
|
||||
|
||||
this.camera = camera;
|
||||
return camera;
|
||||
@@ -118,6 +119,13 @@ public class View3D extends Pane {
|
||||
this.pivot.setY(pivot.getY());
|
||||
this.pivot.setZ(pivot.getZ());
|
||||
}
|
||||
|
||||
public void updatePosition(double x, double y, double z) {
|
||||
this.distance.setX(x);
|
||||
this.distance.setY(y);
|
||||
this.distance.setZ(z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set distance of camera from pivot
|
||||
* @param distance in units
|
||||
@@ -141,4 +149,13 @@ public class View3D extends Pane {
|
||||
public void setPitch(double pitch) {
|
||||
this.pitch.setAngle(-pitch);
|
||||
}
|
||||
|
||||
public void centerCamera(){
|
||||
}
|
||||
|
||||
public void rotateCamera(double angle, double x, double y, double z){
|
||||
camera.setRotationAxis(new Point3D(x, y, z));
|
||||
camera.setRotate(-90);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user