for analogue input like moving the mouse, joystick or pressure sensing devices. A key is more binary, it’s either on/off as opposed to how much a much a mouse has moved from its initial position. Perhaps it makes sense that value could store how long a key is pressed, but im not sure
I’m totally confused by cameras and controls right now…
What I wanted was a first person camera, in a world with collisions and to have a costume control class to control the movement.
I think this is the standard first person shooter setup.
Now I don’t know which camera to use (default camera, flyby camera or costume one), don’t know how to attach a costume control to the shape used for collisions or any other spacial if it’s not a model…
Well, the default is the flyby camera, and I don’t see how you can use it without modifying it and expect to work as a character. You’ll need to move only in X and Z axis, right? You could a lot of things here that came to my mind:
Edit flyby camera so you don’t move in the Y axis
Or you could attach a ChaseCamera to an object, and move that object. Just change the ChaseCamera maximum values so you can freely rotate it. Hide the spatial where you attached the chase camera and zoom in to the max.
That is in the onAnalog. ‘board2’ is a quad attached to the guiNode. The variable ‘movement’ is large (1000 is what I use). The higher it is, the faster ‘board2’ moves. Since I use the ‘movement’ variable, ‘board2’ isn’t in the same position as the mouse’s cursor, so I use the inputManager to make it invisible.
JME gives you access to a gradual value showing the strength of that input. In the case of a keypress that will be the tpf value for which it was pressed since the last frame. For other inputs such as a joystick which give analogue control though then the value will also indicate the strength of the input.
In order to see the total time that a key has been pressed for then the incoming value can be accumulated. The analogue listener may also need to be combined with an action listener so that you are notified when they key is released.