raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.66k stars 2.28k forks source link

[camera] Review 1st person camera implementation #277

Closed raysan5 closed 7 years ago

raysan5 commented 7 years ago

Current implementation for first person camera uses SetMousePosition() to recenter mouse when going out of screen limits, that's not the proper way to handle this situation.

Ideally, mouse should be disabled to get a virtual unlimited canvas mouse and use standard mouse functions to retrieve mouse movement data and use it for first person camera movement.

GLFW (Desktop platforms) and emscripten (HTML5) provide mouse locking functions. Check https://github.com/raysan5/raylib/issues/257 for emscripten implementation details.

GLFW usage examples https://learnopengl.com/#!Getting-started/Camera https://r3dux.org/2014/11/glfw3-basecode-with-fps-camera-controls/ http://stackoverflow.com/questions/38543483/mouse-for-rotation/38543689

raysan5 commented 7 years ago

Implemented in commit https://github.com/raysan5/raylib/commit/fd1fe3ac14adbd4bdc8ed409a65aad9d7d7133ca