# Convert Mouse Location to World Space provides unexpected output

**URL:** <https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073>\
**Category:** Blueprint\
**Tags:** world-space, unreal-engine, Blueprint, question\
**Created:** [January 26, 2015, 9:08pm UTC](https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073 "2015-01-26T21:08:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Wilson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Wilson](https://forums.unrealengine.com/u/Chris_Wilson)\
**Post date:** [January 26, 2015, 9:08pm UTC](https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073/1 "2015-01-26T21:08:04Z")

</div>

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](https://www.youtube.com/watch?v=rcuPuTvWyog)

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:

 ![28012-transmissionbug.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/c/57c3678fc936c9d054f8ea1fb42084fe73ee2353.png)

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

---

<div class="post-metadata">

**Author:** ![Chris\_Wilson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Wilson](https://forums.unrealengine.com/u/Chris_Wilson)\
**Post date:** [February 3, 2015, 9:48pm UTC](https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073/2 "2015-02-03T21:48:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TimtheBlue](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimtheBlue](https://forums.unrealengine.com/u/TimtheBlue)\
**Post date:** [December 22, 2015, 11:47pm UTC](https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073/3 "2015-12-22T23:47:21Z")

</div>

Nice bro, this really helped me out!

---

<div class="post-metadata">

**Author:** ![GlassBeaver](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/glassbeaver/32/551492_2.png) [@GlassBeaver](https://forums.unrealengine.com/u/GlassBeaver)\
**Post date:** [September 10, 2017, 3:35pm UTC](https://forums.unrealengine.com/t/convert-mouse-location-to-world-space-provides-unexpected-output/305073/4 "2017-09-10T15:35:55Z")

</div>

thank you so much, was a life saver!
