show a mouse arrow with an absolute Mouse to operate elements of my HUD.
This works and I see the boxes in front of my Camera.
Now something tricky (where i stuck):
I would like to rotate the cam if I press the right mouse button and drag it left/right and/or up/down.
I get that to work too - but with one issue:
As I press the mouse button and start to drag everything is okay.
But as soon as I rotated the camera about 90° to right or left the cam get slower and slower.
I more think this depends on some camera init parameter, because the deltax and deltay (what I use to rotate the camera) always return some values - I logged that on the console.
To rotate the camera i do:
o_TI_Timer.update();
/** Update tpf to time per frame according to the Timer. */
float tpf = o_TI_Timer.getTimePerFrame();
MouseInput thisMouse = o_IN_Input.getAbsoluteMouse().getMouseInput();
LoggingSystem.getLogger().log(Level.INFO, "Delta: "+thisMouse.getXDelta()+" - "+thisMouse.getYDelta());
o_CA_Kamera.setDirection(o_CA_Kamera.getDirection().add(((float)thisMouse.getXDelta())*tpf, ((float)thisMouse.getYDelta())*tpf, 0.0f));
Is that an camera issue?
Am i doing something wrong?
First if you want to use setDirection then it may help if you normalize the vector. You also need to reset up and left every time you change the direction because all these vectors must be 90 degrees apart. I would recommend using CameraNode instead.
take a look at KeyRotateAction and KeyLookAction. These rotate the camera based on relative mouse movements, but the algorithms should be the same (they do not have problems with slowdown).
You should also not call setFrame explicitly, you should call the update method.