-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the formula for mouse movement vectors ? #130
Comments
In the FPS game, the position of the mouse is fixed in the center of the screen, and what you send is the relative movement of the center of the screen and the target in two-dimensional space each time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote a similar project. This question has been bothering me for a long time.
I can get the location of the enemy projection on the screen. But how to get real mouse movement vectors? In the game, the angle at which the field of view moves is proportional to how many pixels the mouse moves. But there is a tangential relationship between the enemy's projection position and the angle of movement. How to get the distance between the camera and the screen?
I found a similar snippet in your code, so thought you must have found a workaround.
In this code, it seems that you are thinking that the distance between the camera and the screen is 640. I would like to know why this is possible and what the formula means. There is a mathematical principle behind this, or is it obtained by knowing the tangent relationship and adjusting the parameter coefficient?
I would be very grateful if you could answer my questions!
The text was updated successfully, but these errors were encountered: