Finished playable 3D race with first person camera
- Camera pivot must be manually updated - GPS coordinates are scaled by an arbitrary amount to make movement visible - Model has to be flipped 180 degrees to move forward #story[1261]
This commit is contained in:
@@ -17,6 +17,7 @@ public class Subject3D {
|
||||
* Position translation updated by state listeners
|
||||
*/
|
||||
private Translate position;
|
||||
|
||||
/**
|
||||
* Heading rotation updated by state listeners
|
||||
*/
|
||||
@@ -31,7 +32,7 @@ public class Subject3D {
|
||||
this.position = new Translate();
|
||||
this.heading = new Rotate(0, Rotate.Y_AXIS);
|
||||
|
||||
this.mesh.getTransforms().addAll(position, heading, new Rotate(-90, Rotate.X_AXIS));
|
||||
this.mesh.getTransforms().addAll(position, heading, new Rotate(90, Rotate.X_AXIS), new Rotate(180, Rotate.Y_AXIS));
|
||||
}
|
||||
|
||||
public Shape3D getMesh() {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class View3D extends Pane {
|
||||
*/
|
||||
private double farClip;
|
||||
/**
|
||||
* Position camera pivots around
|
||||
* Camera origin
|
||||
*/
|
||||
private Translate pivot;
|
||||
/**
|
||||
@@ -112,14 +112,11 @@ public class View3D extends Pane {
|
||||
this.farClip = farClip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set object to centre on camera
|
||||
* @param pivot centred object
|
||||
*/
|
||||
public void setPivot(Subject3D pivot) {
|
||||
this.pivot = pivot.getPosition();
|
||||
public void updatePivot(Translate pivot) {
|
||||
this.pivot.setX(pivot.getX());
|
||||
this.pivot.setY(pivot.getY());
|
||||
this.pivot.setZ(pivot.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set distance of camera from pivot
|
||||
* @param distance in units
|
||||
@@ -143,8 +140,4 @@ public class View3D extends Pane {
|
||||
public void setPitch(double pitch) {
|
||||
this.pitch.setAngle(-pitch);
|
||||
}
|
||||
|
||||
public PerspectiveCamera getCamera() {
|
||||
return camera;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user