I was trying to find out how much the mouse moved (and in which direction, basically to get a 2D vector) after one second. So basically, when the player presses the mouse we store the current value, add a timer or delay for 1 second, then get the value again, correct? Problem is, which function can I use to get the real position of the mouse?
- Make a CustomPlayerController blueprint that inherits from PlayerController.
- Add a float variable to CustomPlayerController named PreviousMouseX.
- Add a float variable to CustomPlayerController named PreviousMouseY.
- Create a SetTimer and add it to EventBeginPlay, set FunctionName to TickEverySecond (just type it in) and set it to 1 second and looping to TRUE.
- Create a custom event called TickEverySecond.
- Set PreviousMouseX to the value of GetMouseX in TickEverySecond.
- Set PreviousMouseY to the value of GetMouseY in TickEverySecond.
Now you can access previous seconds X & Y coordinates with those variables. How to get how much it has moved is just simple math: PreviousMouseX - GetMouseX.
Thanks for the help and !