Hey there, I'm currently making a game using DirectX11 with c++
I've managed to create key inputs to move the camera, forward,backwards,left,right,up,down.
However i'm struggling with making the mouse control. I need to use the mouse to view which direction the camera is facing.
So it doesn't need clicks its just whichever way you move the mouse with the cursor, the camera will follow.
Had no luck so far.
Any pointers or help would be appreciated thanks
This is not the best way but it is the easiest.
First, call GetCursorPos each frame and store that value. By comparing the result of the current and previous frame, you know how far the mouse moved. Divide this number by some fixed "sensitivity" constant, and apply that as a rotation to your camera matrix. Typically you will want "FPS style" camera control. That means that the mouse X coordinate rotates around the world Y axis, and the mouse Y coordinate rotates around the camera X axis. Then you need to compute the movement vectors in the camera's local coordinates. This is an excellent exercise in beginning linear algebra for games.
As a hint, the variables you need are: