flycam 's setDragToRotate() is set by definition to take the left mouse button click and allows us to rotate the flycam - how can I change that to Right mouse click instead?
I have forked the FlyByCamera.java class but it sounds like a messy work for me - is there a better way to do that simple change?
thanks
Clear its inputs. Set your own.
Check the flyCam’s input settings in its class definition and remove them. It should look like this in the end. (Those are for the chase cam btw).
[java]
app.getInputManager().deleteMapping(“ChaseCamToggleRotate”);
app.getInputManager().addMapping(“ChaseCamToggleRotate”, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
app.getInputManager().addListener(sceneCC, “ChaseCamToggleRotate”);
[/java]
I was just about to add this:
I tried:
[java]app.getInputManager().deleteMapping("FLYCAM_RotateDrag");[/java]
and I get an error that it did not find that mapping…
Put a breakpoint on the line above, highlight “app.getInputManager()” Click the + in the tooltip, check the mapping list…
sorry should have bene more clear, this is what I get in my mapping list:
[java]{=com.jme3.input.InputManager$Mapping@6745b9, SIMPLEAPP_HideStats=com.jme3.input.InputManager$Mapping@128340, SIMPLEAPP_Exit=com.jme3.input.InputManager$Mapping@166ff9c}[/java]
I dont understand why the FLYCAM_RotateDrag is not there
even more confusing is that I created another FlyByCamera.java class forked it to have the right button do the drag instead of the left and did the following:
[java]
// disable default flyCam
flyCam.setEnabled(false);
// initialize FlyCamera
flyCamera = new FlyByCamera(cam);
flyCamera.registerWithInput(app.getInputManager());
flyCamera.setDragToRotate(true);
[/java]
so now it works fine except both the RIGHT and the LEFT mouse click do the dragging. How can the LEFT click still do the dragging ??? I already disabled it…
Debugging I Know that inputManager is cleared and has no mappings, where is that LEFT mouse click being registered???
Edit:
I also get these warnings, so I know what’s the problem but stil I don’t understand where are these mappings coming from?
[java]May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Left” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Left” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Right” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Right” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Up” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Up” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Down” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Down” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_ZoomIn” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_ZoomOut” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_StrafeLeft” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_StrafeRight” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Forward” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Backward” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Rise” twice to trigger.
May 2, 2012 1:01:37 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping “FLYCAM_Lower” twice to trigger.[/java]