Convert Mouse Location to World Space provides unexpected output

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

Ok, I’ve managed to solve this problem.

I didn’t realise that I had to make use of the world direction. I use the world direction multiplied by the length of my camera boom, and add this to the world location. This nullifies the offset I was experiencing, and now the mouse cursor behaves how I expect, yay!!

Hopefully this will help anyone else who shares the same confusion I did.

screenshot

Nice bro, this really helped me out!

thank you so much, was a life saver!