inputManager.setCursorVisible

Does right-clicking automatically call this (true on mouse down / false on mouse up)? At some point this was not the case… though, it seems that this happens by itself now. If so, was there a reason for this change?

Try making a simple test case to show the issue.



My guess is that the test case will work just fine. But if not then we’ll have something to go on.

@pspeed



Ok, here it is. It happens with the ChaseCamera:



[java]

package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.input.ChaseCamera;

import com.jme3.input.MouseInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.MouseAxisTrigger;

import com.jme3.input.controls.MouseButtonTrigger;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;



/**

  • test
  • @author normenhansen

    */

    public class Main extends SimpleApplication {



    public static void main(String[] args) {

    Main app = new Main();

    app.start();

    }



    @Override

    public void simpleInitApp() {

    setPauseOnLostFocus(false);



    //-- MOUSE --//

    inputManager.addMapping("MOUSE_LEFT",new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

    inputManager.addListener(eventListener, "MOUSE_LEFT");

    inputManager.addMapping("MOUSE_RIGHT",new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));

    inputManager.addListener(eventListener, "MOUSE_RIGHT");

    // inputManager.addMapping("MOUSE_MOVE",new MouseAxisTrigger(MouseInput.AXIS_X, false),new MouseAxisTrigger(MouseInput.AXIS_Y, false),new MouseAxisTrigger(MouseInput.AXIS_X, true),new MouseAxisTrigger(MouseInput.AXIS_Y, true));

    // inputManager.addListener(analogListener, "MOUSE_MOVE");

    inputManager.addMapping("MOUSE_MOVE_LEFT",new MouseAxisTrigger(MouseInput.AXIS_X, true));

    inputManager.addListener(eventListener, "MOUSE_MOVE_LEFT");

    inputManager.addMapping("MOUSE_MOVE_RIGHT",new MouseAxisTrigger(MouseInput.AXIS_X, false));

    inputManager.addListener(eventListener, "MOUSE_MOVE_RIGHT");

    inputManager.addMapping("MOUSE_WHEEL_UP",new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));

    inputManager.addListener(eventListener, "MOUSE_WHEEL_UP");

    inputManager.addMapping("MOUSE_WHEEL_DOWN",new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));

    inputManager.addListener(eventListener, "MOUSE_WHEEL_DOWN");



    // Remove frame rate display

    Box b = new Box(Vector3f.ZERO, 1, 1, 1);

    Geometry geom = new Geometry("Box", b);



    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    mat.setColor("Color", ColorRGBA.Blue);

    geom.setMaterial(mat);



    rootNode.attachChild(geom);



    flyCam.setEnabled(false);



    ChaseCamera chaseCam = new ChaseCamera(cam, geom, inputManager);

    chaseCam.setDefaultDistance(.005f);

    chaseCam.setMaxDistance(10f);

    chaseCam.setDefaultHorizontalRotation(0f);

    chaseCam.setDefaultVerticalRotation(0f);

    chaseCam.setZoomSensitivity(20);

    cam.setFrustumFar(170f);

    float aspect = (float)cam.getWidth() / (float)cam.getHeight();

    cam.setFrustumPerspective( 45f, aspect, 0.1f, cam.getFrustumFar() );

    chaseCam.setMinDistance(.005f);

    chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));



    inputManager.setCursorVisible(true);

    }





    private ActionListener eventListener = new ActionListener() {

    public void onAction(String binding, boolean value, float tpf) {

    // GENERAL INTERACTION //

    if (binding.equals("MOUSE_LEFT")) {

    if (value) {

    // inputManager.setCursorVisible(false);

    } else {

    // inputManager.setCursorVisible(true);

    }

    }

    if (binding.equals("MOUSE_RIGHT")) {

    if (value) {



    } else {



    }

    }

    }

    };



    @Override

    public void simpleUpdate(float tpf) {

    //TODO: add update code

    }



    @Override

    public void simpleRender(RenderManager rm) {

    //TODO: add render code

    }

    }

    [/java]

I get the distinct impression that this is effecting the problem I was talking about HERE.

@t0neg0d said:
[java]
flyCam.setEnabled(false);
[/java]


Just in case... since you are completely replacing the fly cam then why not remove it instead of just disabling it? There could be some bad interaction, I suppose... which would be a bug itself. If removing it fixes the problem then we know where to look... though that is also the right way to do this.

Search for "remove FlyCamAppState" if you don't know how to remove an app state already.
@pspeed said:
Just in case... since you are completely replacing the fly cam then why not remove it instead of just disabling it? There could be some bad interaction, I suppose... which would be a bug itself. If removing it fixes the problem then we know where to look... though that is also the right way to do this.

Search for "remove FlyCamAppState" if you don't know how to remove an app state already.


Done... but no effect. Still... glad to know this.

@pspeed

In the ChaseCamera:

[java]

public void onAction(String name, boolean keyPressed, float tpf) {

if (dragToRotate) {

if (name.equals(ChaseCamToggleRotate) && enabled) {

if (keyPressed) {

canRotate = true;

inputManager.setCursorVisible(false); // <<<


} else {
canRotate = false;
inputManager.setCursorVisible(true); // <<<
}
}
}

}
[/java]

That would be why... lol

As for the input issue... let me see what I can find.