[SOLVED] FlyCamera in JME3.2

Hello folks,

New to the group having enjoyed JME for an age. Amazing effort all round.

Anyway - I just updated from JME3.1 to JME3.2 (Stable) to fix known aspect ratio issue on camera.setFrustumPerspective(…). Now it seems the Fly Camera is no longer working correctly, the controls appear reversed for a start. What changed does anybody know?

Regards,
Steve.

I tried to reproduce your issue using BasicGame and was unsuccessful:

  • With JME 3.1, the camera turns in the direction I move the mouse, causing the blue cube to appear to move in the opposite direction.
  • With JME 3.2, the camera turns in the direction I move the mouse, causing the blue cube to appear to move in the opposite direction.

Could you be more specific about which controls appear reversed?
Do you see the reversal using BasicGame?
If you don’t see the reversal using BasicGame, could you provide us with a simple example illustrating the reversal?

-Stephen

Hi Stephen,

Thank you for a speedy response. I have to come clean, I’m not extending SimpleApplication! I hand my head in shame. I’m working on some framework code to provide fluent APIs to JME. A sort of API akin to what JFaces is to SWT. That in addition to building a game (a 2018 version of the 1980’s classic Atari 800 Ballblazer).

My version of BasicGame looks like this (with fluent API)…

public class HelloTemplate extends BaseJME3Application{

    protected void initialise(JmeCollateral jmeCollateral) {
	   // @formatter:off
	    jmeCollateral.getScreenManager().createCamera("default-camera")
		    .atLocation(new Vector3f(1.2f, 1.2f, -10))
		    .withFrame(new Vector3f(-1f, 0f, 0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0f, 0f, 1f))
		    .build("scene-root");
        jmeCollateral.getSceneManager().createBox()
    		.withColour(ColorRGBA.Blue)
	    	.build("scene-root");
	    // @formatter:on
    }

	public static void main(String[] args) {
    	new HelloTemplate().withInitialStates(true, true, false, true).start();
    }
}

I’ve run BasicGame against both 3.1 and 3.2 and they both work well. I therefore fear I’m on my own to work out why the fly cam behaves oddly with my version above. Interestingly, I used a compare utility for LegacyApplication and SimpleApplication and compared them between 3.1 and 3.2. They’ve not changed, so the problem must lie deeper.

The good news is the aspect ratio problem went away, I’m only using the FlyCam as a development tool. :slight_smile:

Best wishes,
Steve.

1 Like

Do you by any chance use JOGL?

Hi again,

No - I’m using LWJGL…

INFO: LWJGL 2.9.3 context running on thread jME3 Main

  • Graphics Adapter: igdumdim64
  • Driver Version: 10.18.10.4425
  • Scaling Factor: 1

I’ve got some digging to do (and limited time daily)… The following image shows the issue I have. The top two show the fly cam. Apart from the strange orientation issue the counts in the lower left tell a story! The bottom two images show the non-fly cam view. For 3.1 and for 3.2. Interestingly the lower left counts are the same. The only thing to have changed is the camera set-up. Very odd. You’ll see the result of the aspect ratio fix that I was after originally.

JME3

I’ll keep the post updated with what I discover as and when.

Steve.

1 Like

Quick note to say it’s now working. The problem seemed to lie in the sequence of when the Camera (used by FlyByCamera) as a result of FlyByAppState is being created. Previously I got away with creating the scene graph and belatedly creating the Camera (viewport etc). With the move to JME 3.2 I no longer could. I’ve updated my code so that the Camera is in place up front and bingo - it’s working again. On to the next challenge.

2 Likes