Help needed with Camera and controls

I want to set up the scene with camera and mouse controls, But I’m unable to find proper tutorial for doing that,

The default camera and controls that come with SimpleApplication is enough for me, but I need to do some modifications to that and I’m unable to find as how to do modify the the camera movement like increasing the speed of movement of camera when w is clicked or mouse click and drag to pan the scene

Thanks in advance

You have a flyCam attribute in simple application that is the control of the cam.

there is a setMoveSpeed Method on the flycam, for your first question.

If you want to implement a specific camera control, look how the flyByCamera and the Chase camera are done, you’ll have to implement your own class.

There’s also an example of how to use this stuff in the tutorial HelloCollision.

[java] this.flyCam.setMoveSpeed(100);



Changing controls:

[java]private void initActionListeners() {


new KeyTrigger(KeyInput.KEY_SPACE), // trigger 1: spacebar

new MouseButtonTrigger(0)); // trigger 2: left-button click

inputManager.addListener(actionListener, “GetTargetInfo”);


private ActionListener actionListener = new ActionListener() {


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

if (name.equals(“KeyLabelNameSomething”) && !keyPressed) {

try {

// Do some stuff here

} catch (Exception e) {






For future reference, source/jme3test contains a lot of useful code examples too.

1 Like