NTUYWANG103 / APEX_AIMBOT

This is a YOLOV7 based APEX and CSGO Aimbot
GNU General Public License v3.0
583 stars 98 forks source link

How to get the formula for mouse movement vectors ? #130

Open EthanH3514 opened 6 months ago

EthanH3514 commented 6 months ago

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.

move_rel_x = self.pidx(atan2(-move_rel_x, self.detect_length) * self.detect_length)
move_rel_y = self.pidy(atan2(-move_rel_y, self.detect_length) * self.detect_length)

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!

PlutoNameless commented 4 months ago

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. The 640 is the window size in the yolo process.