LWJGL Forum

Programming => General Java Game Development => Topic started by: orange451 on November 24, 2015, 21:32:20

Title: Proper way to achieve mouselook in LWJGL3
Post by: orange451 on November 24, 2015, 21:32:20
Hi :)

I wanted to know what the best way to achieve a firstperson styled "mouselook" in lwjgl3 would be.

Originally, I tried using java.awt's MouseInfo class to get information about the mouse position on the screen. I'd then use glfwSetCursorPos to reset the cursor position. However, since you cannot use java.awt on mac I needed to find another way.

I tried using glfwGetCursorPos() and glfwSetCursorPos() to do mouselook (in the whileloop of the game), However, this also does not work on mac, because glfwSetCursorPos() freezes the mouse for 200-300 ms.

[EDIT]
Solved Thanks for Kappa. Here's some documentation on how to do this (http://www.glfw.org/docs/latest/group__input.html#gaa92336e173da9c8834558b54ee80563b)
Title: Re: Proper way to achieve mouselook in LWJGL3
Post by: kappa on November 24, 2015, 22:45:52
The best way to implement mouse look is to use the glfwSetInputMode method to set the GLFW_CURSOR mode to the value GLFW_CURSOR_DISABLED.
Title: Re: Proper way to achieve mouselook in LWJGL3
Post by: orange451 on November 25, 2015, 00:01:25
Fantastic, thank you! ^^

If anyone comes across this topic, here's the documentation: Link (http://www.glfw.org/docs/latest/group__input.html#gaa92336e173da9c8834558b54ee80563b)