I have a fps “camera”, and just recently managed to set up mouse movement to rotate the angle of viewing. The one problem with the camera is that the mouse can leave the window and the angles will not rotate anymore. I know I can use a robot method like mouseMove(), however, I’ve heard that it makes the camera rotation feel very jerky. Is there any other way to keep the mouse in the window, say like, Minecraft? I’m using Minecraft as an example because my program uses LWJGL too, and I was wondering how Notch does it. Any suggestions?
I have a fps camera, and just recently managed to set up mouse movement
Share
Mouse.setGrabbed(true)at a start-up moment,and for every game-loop(frame):
catch mouse movement with
Y_Angle += Mouse.getDX()*0.1f,then rotate your view matrix around Y axis on
Y_Angledegrees/radians.For rotation around X and Z axes use
Mouse.getDY()and think on your own how to implement right matrix rotation for those, but this is the main idea.