I want to get a first person camera (like Call of Duty or Minecraft etc.) but I don't know which is the best way to do it.

I have some camera increase rotation methods (camera.increase Rotation(x,y,z) the y is only the up and down looking).

The thing is I don't know how to make it work so that the mouse can stay in the middle but the rotation is increasing.

Any information is welcome regarding this subject.


2 Answers 2


It depends on the framework you use. Locking the cursor is basically done by setting the cursor to the center each frame and use the delta movement in x and y direction for your camera rotation.


You could use your framework to hide either hide the mouse cursor or set it to use a default, invisible cursor. You can then just draw your crosshairs in the middle of the screen and rotate your camera according to the mouse's movements.

Unlike Benedikt's awnser this still allows the cursor to move, wether you want this to happen is up to you.

  • \$\begingroup\$ But then the mouse will leave the window after a certain point which you don't want. You will want infinite freedom. \$\endgroup\$ Commented Mar 17, 2016 at 1:08
  • \$\begingroup\$ Like I said, that's a design decision for the asker to awnser. there might be cases where you will want to be able to use the mouse to close the window for example. Although I agree with you that your suggested solution will more likely be what the asker is looking for. \$\endgroup\$
    – Niels
    Commented Mar 17, 2016 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .