If I use flyCam.setEnabled(false); to disable the default flycam what code do I have to use to make the mouse look around?
You want to re-orient the camera based on mouse input.
The default camera provided by
SimpleApplication is named
cam. You probably want one of the following methods in
public void setRotation(Quaternion rotation),
public void lookAt(Vector3f pos, Vector3f worldUpVector) or
public void lookAtDirection(Vector3f direction, Vector3f up).
Should I use those methods in the simpleUpdate() method or the onAnalog() or onAction()
method from the AnologListener and ActionListener interface?
Instead of using
simpleUpdate() I recommend creating a custom
AppState to control the camera. The
AppState will probably need an
AnalogListener interface to know when the mouse moves. Depending on your requirements, it may also need an
ActionListener interface to know when mouse buttons are pressed/released.
What is it that you are actually trying to do?
Why do you disable the fly cam if you want to look around? That’s what the fly cam does.
If a guessed answer is “So I can do something custom.” Then given your level of knowledge, your best bet is to open FlyCam.java, ctrl-A, Ctrl-C, then copy that into a new file and modify it accordingly.
if you want for example Strategy Camera view where mouse on “edges” move arround map, yes, you disable default and do own with onAnalog() or onAction() depend what you exactly need.
app.getInputManager().setMouseVisibility(param) (or similar name) was to set mouse visible or not.
Please note you can also use ChaseCamera class and for example make it work when “MMB” is pressed(to rotate view), when not then make mouse appear and you can scroll arround map.
Everything depends what you exactly need.
Indeed. We’ve spent more time guessing than OP spent asking.
The reason I turned the flycam off is because the documentation says if you want to make a camera follow a 3rd person character, in my case a cube you have to configure your own navigation. I made a cube and a cameranode which follows my cube. When I start my game
the cube falls down on to a terrain and the camera follows. Then I used the code from the documentation to make the cube go forward, backward, left and right with the W,S,A,D keys and the camera follows. Problem is the documentation doesn’t provide the code for the mouse to look around. I tried alot of things but nothing works.
If that had been your first post then it would have saved so many peoples’ wasted time answering guessed questions.
Have you tried the chase camera?
Not yet but I will.