Add methods to control FlyByCamera zooming speed.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9759 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
iwg..ic 13 years ago
parent 47cb989c63
commit 8daa039ecc
  1. 20
      engine/src/core/com/jme3/input/FlyByCamera.java

@ -76,6 +76,7 @@ public class FlyByCamera implements AnalogListener, ActionListener {
protected Vector3f initialUpVec;
protected float rotationSpeed = 1f;
protected float moveSpeed = 3f;
protected float zoomSpeed = 1f;
protected MotionAllowedListener motionAllowed = null;
protected boolean enabled = true;
protected boolean dragToRotate = false;
@ -134,6 +135,23 @@ public class FlyByCamera implements AnalogListener, ActionListener {
public float getRotationSpeed(){
return rotationSpeed;
}
/**
* Sets the zoom speed.
* @param zoomSpeed
*/
public void setZoomSpeed(float zoomSpeed) {
this.zoomSpeed = zoomSpeed;
}
/**
* Gets the zoom speed. The speed is a multiplier to increase/decrease
* the zoom rate.
* @return zoomSpeed
*/
public float getZoomSpeed() {
return zoomSpeed;
}
/**
* @param enable If false, the camera will ignore input.
@ -294,7 +312,7 @@ public class FlyByCamera implements AnalogListener, ActionListener {
float fovY = FastMath.atan(h / near)
/ (FastMath.DEG_TO_RAD * .5f);
fovY += value * 0.1f;
fovY += value * 0.1f * zoomSpeed;
h = FastMath.tan( fovY * FastMath.DEG_TO_RAD * .5f) * near;
w = h * aspect;

Loading…
Cancel
Save