Skip to content

FlyByCamera inconsistencies (bugs when using setUp(z-axis) ) #617

@knegrum

Description

@knegrum

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSomething that is supposed to work, but doesn't. Less severe than a "bug"

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions