# Shoot Projectiles at Mouse Pointer in a 3d space

**URL:** <https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492>\
**Category:** Blueprint\
**Tags:** child-actors, unreal-engine, editor, UE4, Blueprint, question\
**Created:** [August 8, 2016, 1:43pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492 "2016-08-08T13:43:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 8, 2016, 1:43pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/1 "2016-08-08T13:43:26Z")

</div>

Hi there!  
Is available any way of shooting projectiles at mouse pointer in a 3d space from an actor blueprint?

---

<div class="post-metadata">

**Author:** ![plojnitza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plojnitza](https://forums.unrealengine.com/u/plojnitza)\
**Post date:** [August 8, 2016, 2:00pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/2 "2016-08-08T14:00:18Z")

</div>

Yes there is. Provide more details.  
Going from 2D (mouse pointer ) to 3D , requires to add a coordinate (Z) from nothing. So this is something that must result from design.

---

<div class="post-metadata">

**Author:** ![NoobsDeSroobs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoobsDeSroobs](https://forums.unrealengine.com/u/NoobsDeSroobs)\
**Post date:** [August 8, 2016, 3:39pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/3 "2016-08-08T15:39:56Z")

</div>

Here is another question I have answered that is the same question:

[How to shoot at mouse location.](https://answers.unrealengine.com/questions/462268/top-down-wasd-mouse-shoot.html#answer-462283)

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 8, 2016, 10:39pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/4 "2016-08-08T22:39:00Z")

</div>

what do you mean by design?

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 8, 2016, 10:48pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/5 "2016-08-08T22:48:36Z")

</div>

Well I’ve tried yours already and as a result the projectile flies only in one direction no matter how I rotate my character or how I change the mouse position

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 8, 2016, 10:52pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/6 "2016-08-08T22:52:24Z")

</div>

I basically have a pawn that can rotate around around following the mouse position and I try to make a projectile leave one of the child actor towards mouse location.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b6878a2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b6878a2](https://forums.unrealengine.com/u/anonymous_user_2b6878a2)\
**Post date:** [August 8, 2016, 11:15pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/7 "2016-08-08T23:15:00Z")

</div>

Have you tried something along the lines of:

 ![102051-lookatmousecursor.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/a/83a7fad15d9038d235dd7017f738ef81b6525f52.png)

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 9, 2016, 7:01am UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/8 "2016-08-09T07:01:36Z")

</div>

Yea unfortunately and as a result the projectile flies backwards, towards me.

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 9, 2016, 8:54am UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/9 "2016-08-09T08:54:28Z")

</div>

Is there a way to make a line trace from camera to mouse cursor and the weapon that i’ve created to fire there if hits something, if not to fire at the max range?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b6878a2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b6878a2](https://forums.unrealengine.com/u/anonymous_user_2b6878a2)\
**Post date:** [August 9, 2016, 2:27pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/10 "2016-08-09T14:27:04Z")

</div>

You want it to go the other way? then just switch the start and target of the look at rotation.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b6878a2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b6878a2](https://forums.unrealengine.com/u/anonymous_user_2b6878a2)\
**Post date:** [August 9, 2016, 2:29pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/11 "2016-08-09T14:29:14Z")

</div>

You can check to see if the linetrace results in a hit, if it does then execute code to fire at that target, if not tell it to fire at max range. Just use the “return Value” on the end of the line trace node.

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 10, 2016, 11:52am UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/12 "2016-08-10T11:52:21Z")

</div>

ok. So I have managed to shoot at target location but it doesn’t seem to be accurate…it’s like very near from it. I want to mention that the srojectile is fired from a side to that hit location and the trace channel if fired from camera. Any ideeas ?

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 10, 2016, 12:59pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/13 "2016-08-10T12:59:59Z")

</div>

All right! After many trials I managed to pull it up. Thanks for your response guys. That gave me a glimps of what I have to do.

---

<div class="post-metadata">

**Author:** ![Isadora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isadora](https://forums.unrealengine.com/u/Isadora)\
**Post date:** [August 10, 2016, 1:02pm UTC](https://forums.unrealengine.com/t/shoot-projectiles-at-mouse-pointer-in-a-3d-space/366492/14 "2016-08-10T13:02:33Z")

</div>

![102305-help.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/1/4/014afdfc7f6933c81ee2eedbbea35a9d86b217ec.png)
