-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Got a strange bug when using QZ keys to move camera after using setUp() to z-axis.
IMHO source of prob is in file
./jme3-core/src/main/java/com/jme3/input/FlyByCamera.java
// ...
protected void riseCamera(float value){
Vector3f vel = new Vector3f(0, value * moveSpeed, 0); // hardcoded y-axis
// effect: even when using setUp(z-axis), Q and Z keys still move along y-axis
Vector3f pos = cam.getLocation().clone();
if (motionAllowed != null)
motionAllowed.checkMotionAllowed(pos, vel);
else
pos.addLocal(vel);
cam.setLocation(pos);
}
// ... moveCamera does it correctly (just for comparison)
protected void moveCamera(float value, boolean sideways){
Vector3f vel = new Vector3f();
Vector3f pos = cam.getLocation().clone();
if (sideways){
cam.getLeft(vel); // query left-axis, in case it's set to another axis
}else{
cam.getDirection(vel);
}
vel.multLocal(value * moveSpeed);
if (motionAllowed != null)
motionAllowed.checkMotionAllowed(pos, vel);
else
pos.addLocal(vel);
cam.setLocation(pos);
}