jMonkeyEngine / jMonkeyEngine/jmonkeyengine
FlyByCamera inconsistencies (bugs when using setUp(z-axis) )
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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