# Shooting projectiles in random directions when mouse cursor overlaps player?

**URL:** <https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514>\
**Category:** World Creation\
**Tags:** direction, unreal-engine, twin-stick, Physics, top-down, projectile, question\
**Created:** [June 29, 2021, 1:13am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514 "2021-06-29T01:13:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SyntheticLove](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/syntheticlove/32/772935_2.png) [@SyntheticLove](https://forums.unrealengine.com/u/SyntheticLove)\
**Post date:** [June 29, 2021, 1:13am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514/1 "2021-06-29T01:13:43Z")

</div>

I’ve attempted to do this in many different ways but to no Avail The projectile usually hits the ground underneath the player I’m currently using a slightly modified Twin Stick shooter template if that helps.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 29, 2021, 7:00am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514/2 "2021-06-29T07:00:22Z")

</div>

Can you show your projectile code?

EDIT: Having typed that, I’m already wondering about the collision of anything you may have added to the pawn…

---

<div class="post-metadata">

**Author:** ![SyntheticLove](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/syntheticlove/32/772935_2.png) [@SyntheticLove](https://forums.unrealengine.com/u/SyntheticLove)\
**Post date:** [June 29, 2021, 9:16am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514/3 "2021-06-29T09:16:46Z")

</div>

Sure and to answer your question no other collision was added to the base pawn apart from a different SM.

---

<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:** [June 29, 2021, 9:55am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514/4 "2021-06-29T09:55:44Z")

</div>

> The projectile usually hits the ground  
> underneath the player

`Get Hit Result Under Cursor` hits the floor - so you’re attempting to shoot at the floor. Either add Z offset to the hit location or use a method that does not revolve around getting hits from level geometry:

> [@Line Trace from a 3d point to mouse location](https://forums.unrealengine.com/t/line-trace-from-a-3d-point-to-mouse-location/237661):
>
> I’m making a 3d side-scroller game and I want to do a line trace from the character glasses to wherever I click on the screen with the mouse. 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. This is the best I could do, but it’s not accurate - When I click roughly in the center of the screen the trace is pretty accurate, but when I click further away from the center it gets less and less accurate…So…What am I doing w…

In your case you’d use 0,0,1 as Normal and place the plane at gun height.

* * *

But to be honest, it all depends how you want it to work. Do we always shoot at the same level? What if the enemy is higher / lower than us?

---

<div class="post-metadata">

**Author:** ![SyntheticLove](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/syntheticlove/32/772935_2.png) [@SyntheticLove](https://forums.unrealengine.com/u/SyntheticLove)\
**Post date:** [June 29, 2021, 11:46am UTC](https://forums.unrealengine.com/t/shooting-projectiles-in-random-directions-when-mouse-cursor-overlaps-player/485514/5 "2021-06-29T11:46:47Z")

</div>

It was that easy…well then…I appreciate the help
