Boat scaling is correct.
- scaling changes as a user zooms in or out to - 3rd person view defaults to life size scale #story[1312]
This commit is contained in:
@@ -86,6 +86,7 @@ public class View3D extends Pane {
|
|||||||
private final double MAX_PITCH = 60; // birds eye view
|
private final double MAX_PITCH = 60; // birds eye view
|
||||||
private final double MIN_PITCH = 5; // third person view
|
private final double MIN_PITCH = 5; // third person view
|
||||||
private final double ZOOM_PER_KEYPRESS = 5; // distance changed per zoom
|
private final double ZOOM_PER_KEYPRESS = 5; // distance changed per zoom
|
||||||
|
private double itemScale = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for View3D. Sets up Scene and PerspectiveCamera.
|
* Default constructor for View3D. Sets up Scene and PerspectiveCamera.
|
||||||
@@ -188,10 +189,7 @@ public class View3D extends Pane {
|
|||||||
public void setThirdPerson() {
|
public void setThirdPerson() {
|
||||||
this.setDistance(ZOOM_IN_LIMIT * 2);
|
this.setDistance(ZOOM_IN_LIMIT * 2);
|
||||||
adjustPitchForZoom();
|
adjustPitchForZoom();
|
||||||
|
adjustScaleForZoom();
|
||||||
for(Subject3D item: items) {
|
|
||||||
item.setScale(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,11 +197,8 @@ public class View3D extends Pane {
|
|||||||
*/
|
*/
|
||||||
public void setBirdsEye() {
|
public void setBirdsEye() {
|
||||||
this.setYaw(0);
|
this.setYaw(0);
|
||||||
this.setPitch(60);
|
this.setPitch(MAX_PITCH);
|
||||||
|
adjustScaleForZoom();
|
||||||
for(Subject3D item: items) {
|
|
||||||
item.setScale(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,10 +273,35 @@ public class View3D extends Pane {
|
|||||||
untrackSubject();
|
untrackSubject();
|
||||||
setDistance(1050);
|
setDistance(1050);
|
||||||
updatePivot(new Translate(250, 0, 210));
|
updatePivot(new Translate(250, 0, 210));
|
||||||
|
setYaw(0);
|
||||||
} else {
|
} else {
|
||||||
setDistance(distance);
|
setDistance(distance);
|
||||||
}
|
}
|
||||||
adjustPitchForZoom();
|
adjustPitchForZoom();
|
||||||
|
adjustScaleForZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjusts the scale size of boats and markers as a user zooms in or out,
|
||||||
|
* to smooth the change between third person to birds eye view.
|
||||||
|
*/
|
||||||
|
private void adjustScaleForZoom(){
|
||||||
|
double itemScale = (((-distance.getZ() - (ZOOM_IN_LIMIT * 2)) /
|
||||||
|
((THIRD_PERSON_LIMIT - (ZOOM_IN_LIMIT * 2)) /
|
||||||
|
(1 - 0.1))) + 0.1);
|
||||||
|
// if zoomed right in
|
||||||
|
if (itemScale < 0.1){
|
||||||
|
itemScale = 0.1;
|
||||||
|
// if zoomed right out
|
||||||
|
} else if (itemScale > 1) {
|
||||||
|
System.out.println("over 1");
|
||||||
|
itemScale = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update scale
|
||||||
|
for (Subject3D item : items) {
|
||||||
|
item.setScale(itemScale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user