# Shoot at mouse location

**URL:** <https://forums.unrealengine.com/t/shoot-at-mouse-location/251434>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [September 18, 2021, 4:53pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434 "2021-09-18T16:53:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iscreamdeye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iscreamdeye](https://forums.unrealengine.com/u/Iscreamdeye)\
**Post date:** [September 18, 2021, 4:53pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434/1 "2021-09-18T16:53:36Z")

</div>

How to rotate object or scene on Z based on where mouse is on screen?

 ![Capture](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/e/eebb2d808e01b9d4d48d00891a8d5aaf63098ab3.png)

---

<div class="post-metadata">

**Author:** ![Iscreamdeye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iscreamdeye](https://forums.unrealengine.com/u/Iscreamdeye)\
**Post date:** [September 18, 2021, 4:58pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434/2 "2021-09-18T16:58:34Z")

</div>

![Capture3](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/f/efa919692a55539cab9ecf73f40ad32b06024ca4.png)  
I am trying to get rotation from this but it looks like something is missing

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [September 21, 2021, 6:16pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434/3 "2021-09-21T18:16:04Z")

</div>

Think you need to create something that’s on the same plane as your ship and when mouse clicks have the it turn towards that.

If I’m not mistaken, convert mouse to world space sets the location of you mouse where the camera is. You need to (for example) shoot a trace that intersects with the ship’s plane (I’m guessing Z=0 in your case since camera is looking down) and set that position as a target to look/move towards.

You could create a plane big enough that will only collide with your trace and have the hit location as your point to look at or you could calculate per click with some creative math.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 21, 2021, 6:44pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434/4 "2021-09-21T18:44:16Z")

</div>

> [@pezzott1](#):
>
> You could create a plane big enough that will only collide with your trace and have the hit location as your point to look at or you could calculate per click with some creative math.

This. But you do not need to actually create a physical plane - the creative math bit works.

Have a look here:

> [@Line Trace from a 3d point to mouse location](https://forums.unrealengine.com/t/line-trace-from-a-3d-point-to-mouse-location/237661/3):
>
> You’re tracing with a fixed distance of 500, replacing the projection’s X with a fixed value. It’s actually hard to imagine how that would look like, a strangely distorted / twisted undulating surface mayhaps? cool, for sure. I want this trace to stay on the same plane as my character, so the X value of the start point & end point should be the same. Consider the following: green_circle create a virtual plane where the character is and point it towards X (Plane Normal 1,0,0) …

Imagine the dude is the ship, the camera is above. Now that you have a location on the _plane_, you can Find Look at Rotation.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [September 21, 2021, 6:58pm UTC](https://forums.unrealengine.com/t/shoot-at-mouse-location/251434/5 "2021-09-21T18:58:07Z")

</div>

This is very good info. Thank you for sharing!
