Unregister / register flycam input

My JME App extends SimpleApplication. I added an ActionListener that handles a function key. The listener has this code:

    if (flyCamAttached) {
        flyCam.unregisterInput();
    } else {
        flyCam.registerWithInput(getInputManager());
    }
    flyCamAttached = !flyCamAttached;

So far this works: I can press the function key, disengage the JME app window and do stuff in other windows. Then click into the JME app window to give it focus and press the function key to give JME the mouse and keyboard back.

With this in place I added functionality to add new objects to the scene graph using: rootNode.attachChild(geo). What I’m seeing is that the objects added after unregister/register don’t interact with the fly cam the same way as the objects added initially - specifically they seem to be “stuck” in the same plane as the flycam. So for example if I rotate left - the objects placed into the scene graph initially move right as expected. But the objects added after unregister/register move with the camera meaning - as I rotate left they also rotate left so I’m always viewing them with the same perspective.

Any guidance is appreciated.

A normal app will never do this.

You must have done something with viewports or changing the root node or something else.

Camera is generally 100% separate from the scene.

If all you want to do is release and recapture the mouse, then this is the wrong approach. Check if the flyCam has a setEnabled() method, that would probably be a better way to go.

Well I actually want to release all input - mouse and keyboard. Turns out I was mistaken - I was interpreting the perspective incorrectly. Thanks