# ThirdPerson fire Projectile, trace to sky

**URL:** <https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474>\
**Category:** World Creation\
**Tags:** Sky, thirdperson, Trace, aiming, unreal-engine, Blueprint, question\
**Created:** [May 5, 2015, 4:44am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474 "2015-05-05T04:44:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![juniortan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@juniortan](https://forums.unrealengine.com/u/juniortan)\
**Post date:** [May 5, 2015, 4:44am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/1 "2015-05-05T04:44:16Z")

</div>

So I have been playing with the thirdperson template and added quite a few things.  
But there’s one thing I couldn’t figure out how to fix, which is Shooting Projectile while Aiming at the sky.  
I have recorded a short clip demonstrating the issue I am facing,

Watch it here:[YouTube](https://youtu.be/xH-x3YJFlQs?t=17s "title")

Is there any workaround for this kind of situation? Please help!

And here are the blueprints that handles my projectile spawn:  
!41355-  
!41356-

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 4:47am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/2 "2015-10-10T04:47:59Z")

</div>

Did you ever find a solution to this I am having the same issue and can’t seem to get it figured out…there must be something causing it to redirect to location 0 0 0. Something I did as a semi work around was set a different spawn if the hit result bool is false so the projectile will just fire in the direction that the weapon socket is pointed in but that takes away some of the functionality that I wanted to achieve with the line trace.

---

<div class="post-metadata">

**Author:** ![juniortan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@juniortan](https://forums.unrealengine.com/u/juniortan)\
**Post date:** [October 10, 2015, 9:20am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/3 "2015-10-10T09:20:11Z")

</div>

This was 7 months ago, nobody tried to help so I kinda gave up on it and settled with spawning projectile forward when line trace return false.

But I just thought of a workaround while typing this reply. You can try to create a large invisible box the encapsulate the level and set the line trace distance to be long enough to reach it. Let me know if it works 🙂

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 9:30am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/4 "2015-10-10T09:30:53Z")

</div>

This is how I ended up fixing the problem:

 ![62104-linetraceissuefix1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/b/26b4860dec04b21ab01ed7f6b508c78c50562996.png)

 ![62105-linetraceissuefix2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/4/594a6ea28c7662f7ef6f7bd980152ba0a1dfc1f0.png)

---

<div class="post-metadata">

**Author:** ![juniortan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@juniortan](https://forums.unrealengine.com/u/juniortan)\
**Post date:** [October 10, 2015, 10:44am UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/5 "2015-10-10T10:44:21Z")

</div>

What the logic behind it?

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 1:19pm UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/6 "2015-10-10T13:19:35Z")

</div>

If the trace fails to hit an object within the accuracy range it will get the last reachable point of the trace (500000 unit out) and then get the X axis for the projectile to align with, this way objects that are very close still get hit in the center of crosshairs and further out it maintains most of the accuracy (full accuracy out to 500000 units slightly degrading after) everything after the “SpawnActor” node has to do with the sounds and emitters etc for the muzzle. If the trace hit is true it will point the X axis of the projectile towards center of crosshairs since the closer the object the closer the intersection of the 2 points becomes…at further distances the points are closer together…if the trace-end doesn’t hit something for some reason the spawn will give it a X axis pointed toward world location 0 0 0 so this is the way I got around that.

I hope that makes sense, it also keeps everything within the projectile spawning functions short and simple with out adding giant actors to scene.

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 1:27pm UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/7 "2015-10-10T13:27:18Z")

</div>

I will post a video in just a few showing you the differences between first way and second

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 2:00pm UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/8 "2015-10-10T14:00:02Z")

</div>

[Video Demo](https://youtu.be/ZjakpQg_SWM)  
This video show the difference between using the branch and not using it, using it give us the extra spawnactor node that will get the X axis of the last reachable point of the trace to use in the spawn transform of the projectile if the line trace doesn’t actually hit something. I hope it helps clarify what I am talking about. The way I am doing it works but I was looking for possibly better solutions, which is why I asked you what your solution was if any. Let me know if you need more info also if I find a better way of doing this I will make sure to post it here for you.

---

<div class="post-metadata">

**Author:** ![earthur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@earthur](https://forums.unrealengine.com/u/earthur)\
**Post date:** [October 10, 2015, 2:10pm UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/9 "2015-10-10T14:10:10Z")

</div>

In your case you can use the location for the “End” pin of the trace for the last reachable point (“Max Accuracy Range” in my screen shot) and then use the “Projectile Spawn Z Offset” vector variable (the “Barrel Mesh - Socket location” from screen shot) Subtract the “End” pin for your “Z Offset” variable then from there a “Make Rot from X” node to the “Make Transform” node of the “False” pin SpawnActor and use the “End” pin location for the spawn actor transform location and that should fix it for you. Let me know if that works

---

<div class="post-metadata">

**Author:** ![juniortan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@juniortan](https://forums.unrealengine.com/u/juniortan)\
**Post date:** [October 10, 2015, 3:12pm UTC](https://forums.unrealengine.com/t/thirdperson-fire-projectile-trace-to-sky/317474/10 "2015-10-10T15:12:13Z")

</div>

cool, move your post to answer so that i can mark it as an answer.
