jMonkeyEngine / jMonkeyEngine/jmonkeyengine

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

Open
#617 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defect
Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in jme3-core/src/main/java/com/jme3/input/FlyByCamera.java, reading riseCamera(float) alongside moveCamera(float, boolean). Check how setUp() changes the camera's up axis and compare that with the hardcoded movement vector. Done means Q and Z movement follows the configured up axis rather than always using the y-axis.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.