-1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ But then the mouse will leave the window after a certain point which you don't want. You will want infinite freedom. \$\endgroup\$ Mar 17 '16 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
    Mar 17 '16 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.