I am making a top down game where you directly control a pawn using WSAD, and aim using the mouse.
I have blueprint script to rotate the player towards the mouse pointer when you are ‘aiming’ (holding down the mouse button). When the player pawn is stationary, this works as expected. As you move the mouse around, the player rotates the face this direction.
However, when the player is moving, they rotate to face the wrong direction. I added a debug point to show the location given by the ‘Convert Mouse Location to World Space’ function. This matches my cursor exactly when stationary, but shoots off in the wrong direction once moving.
I’ve uploaded a short video of the issue here - - YouTube
The black dot is my mouse cursor, and the pink square is the output position from the function.
Here’s the blueprint I’m using to get this:
The rest of my character is not too dissimilar to the stock 3rd person example code.
Could anyone shed any light on what is causing this output? I can’t decide if the value is being offset somehow, being delayed a number of frames behind the rest of the game, or something else entirely!
Please let me know if there’s anything else you need to see, and I’ll post it up.
Thanks,
/Chris