# How to Line Trace in all directions?

**URL:** <https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, Blueprint, question\
**Created:** [June 2, 2022, 9:40am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301 "2022-06-02T09:40:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 2, 2022, 9:40am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/1 "2022-06-02T09:40:10Z")

</div>

How can I do a line trace outwards from a characters head in all directions creating a perfect sphere of line traces? Please show with blueprint example and explain like I’m 5, thank you!

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [June 2, 2022, 9:47am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/2 "2022-06-02T09:47:20Z")

</div>

All directions is a vague notion, because all directions is infinite directions.  
What exactly are you trying to achieve?

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 2, 2022, 9:50am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/3 "2022-06-02T09:50:04Z")

</div>

I want a sphere of line traces emanating outward from a point (not a sphere trace)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [June 2, 2022, 9:56am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/4 "2022-06-02T09:56:09Z")

</div>

That’s understandable; I meant what’s the purpose of these traces?  
You can do some math and shoot a bunch of traces with some angle increment, but that’s going to be really expensive performance-wise, and quite inefficient at long ranges.  
Are you sure a multi-sphere trace or simply a sphere collision won’t do the job?

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 2, 2022, 10:29am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/5 "2022-06-02T10:29:33Z")

</div>

Can you show what a blueprint doing that would look like please?

---

<div class="post-metadata">

**Author:** ![DomusLudus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domusludus/32/1215140_2.png) [@DomusLudus](https://forums.unrealengine.com/u/DomusLudus)\
**Post date:** [June 2, 2022, 11:22am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/6 "2022-06-02T11:22:24Z")

</div>

I think he is asking precisely about multi-sphere trace

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/a/d3ab7d4c111db0d07c71ed2c78f23cdea863461e.jpeg "WTF Is? Multi Sphere Trace For Objects in Unreal Engine 4 ( UE4 )") ](https://www.youtube.com/watch?v=cPMMlH6tCzo)

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [June 2, 2022, 11:31am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/7 "2022-06-02T11:31:12Z")

</div>

if you want to detect anything within a sphere around an actor, why not use a sphere collider?

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 2, 2022, 11:32am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/8 "2022-06-02T11:32:53Z")

</div>

Ive already seen that video, and no thats not what I am trying to do. I just want to be able to fire line traces in a sphere formation outward thats all

---

<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 2, 2022, 11:36am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/9 "2022-06-02T11:36:34Z")

</div>

It is possible, but your frame rate will tank very badly…

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 2, 2022, 11:40am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/10 "2022-06-02T11:40:58Z")

</div>

I’m willing to take that risk, can you do it?

---

<div class="post-metadata">

**Author:** ![DomusLudus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domusludus/32/1215140_2.png) [@DomusLudus](https://forums.unrealengine.com/u/DomusLudus)\
**Post date:** [June 2, 2022, 11:45am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/11 "2022-06-02T11:45:10Z")

</div>

Well, he wants to throw traces, if he asked how to detect actors, the sphere could be a better option. That it’s bad for the performance is not my problem, hahaha.  
Although the trace give a lot of information about what they hit if you want to look at your surroundings including static objects.

---

<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 2, 2022, 11:54am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/12 "2022-06-02T11:54:59Z")

</div>

This post

> [@How to place n equidistant points on a sphere?](https://forums.unrealengine.com/t/how-to-place-n-equidistant-points-on-a-sphere/494016/4):
>
> Wow! Thank you so much for this lead. I just played around a bit and it is exactly what I was hoping to find! So, the next step is having objects anchor at the centre of the sphere and radiate out at the points as determined by Niagara\>Particle Spawn\>Sphere Location. I wonder if that can be achieved with ribbons, since I essentially do want to have ribbon-like formations coming out of the sphere. Do you think I should open this up as a new question? Your answer really is the solution to the ma…

shows you how to place N points evenly spaced on the surface of a sphere. You can adapt this code to make your traces.

---

<div class="post-metadata">

**Author:** ![eldany.uy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eldany.uy/32/821920_2.png) [@eldany.uy](https://forums.unrealengine.com/u/eldany.uy)\
**Post date:** [June 2, 2022, 12:53pm UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/13 "2022-06-02T12:53:20Z")

</div>

here is a way of doing what you want to achieve.  
I don’t know what is you goal with this but trace a lot of lines in a sphere to detect stuff around is a very inefficient way to do it. I we have a closer knowledge about what you trying to achieve maybe we can help you with a better approach of what you need.

I am not good with kids so I cant explain it as you were a 5yo sorry

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/3/1f3cace70844afa42f6eaf3856d64c84b2c7d7f9.jpeg "UE4 Spherical line trace") ](https://www.youtube.com/watch?v=UoRmuKfcG-U)

Good Luck!  
Dany

---

<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 2, 2022, 1:48pm UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/14 "2022-06-02T13:48:36Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/7/c7778fe4c0d647bdff828203c8fe301175d1e42b.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/1/b21643280797783fa286a676da10e087c6a755bd.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/b/ecbe673efc3f6aa50357d0e1ae151d056b7624f1.png)

GR = 1.618

![spherical2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/1/bd11bae8e65462ed64a171a2b014cf7f0f5e49e1.gif)

---

<div class="post-metadata">

**Author:** ![eldany.uy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eldany.uy/32/821920_2.png) [@eldany.uy](https://forums.unrealengine.com/u/eldany.uy)\
**Post date:** [June 2, 2022, 2:12pm UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/15 "2022-06-02T14:12:54Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/b/6cb3e3b35e62ee0a347a1018eba39c4c1338db73.jpeg)

---

<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 2, 2022, 2:14pm UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/16 "2022-06-02T14:14:42Z")

</div>

Those things are sharp…

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 3, 2022, 1:24am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/17 "2022-06-03T01:24:33Z")

</div>

Well hot dam! You really are a hero, the friendly Cyberhood UnrealMan. I miss the old answer hub, and your name on the weekly scoreboard 😛

Now that I’ve buttered you up, three things (please):

1. what does the “GR=1.618” mean, if you could please explain

2. How to increase the Resolution of the traces, meaning more traces to make a more dense sphere (of traces)

3. The following is a great tutorial on what I am (roughly) trying to do, how to create a line of sight effect, but this tutorial is in 2D XY plane only.  
It does not account for elevation/height, thus I need a modified “3D Line of Sight XYZ plane” system, so that the shadows/dark areas are instinctively appropriate:

> **[TUTORIAL: Line of Sight Visualizer for Unreal Engine](https://hippowombat.medium.com/tutorial-line-of-sight-visualizer-for-unreal-engine-f32113b1f6f3)**
>
> Intermediate Tutorial

* * *

Hence, the 720 spherical trace 😏  
In the tutorial above he uses a _ **Single Triangle as a 1 degree “Slice” for the Procedural Mesh in a 360 degree, XY 2D-Plane only** _  
(you can download it and see what I am talking about).  
So my question is, how would you convert that to a _ **3D XYZ** _ version?  
My thought was to convert the single flat triangle mesh he provides 🔻 into a 3 sided pyramid.  
And then use that in the spherical line trace we have established,  
to create the (red/black) antimask or whatever, but as 3D/2.5D?  
How does that sound?

 ![HalaFruit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/c/15c12982ada811c72194d56edd135f6cdae50f20.jpeg)

|  
|  
|  
|  
|  
_ **Please consider the following use case carefully as the test bench environment** _:  
(How/where would the appropriate shadow/dark areas be vs light areas, from the characters perspective, not the cameras.  
Thus giving the player, a sense of immersion from a distance).  
Hope that makes sense, and thank you  
(click gyazo link for bigger version)

> **[Gyazo](https://gyazo.com/92b556f3c521741ab14c4f31c32754e7)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

_**The little hatch in the ceiling will be visible upon looking up,  
but you will have to climb up for the next floor to become visible**_  
|  
|  
|  
|  
|

* * *

_**1)- The walls/ceilings/floors in the way of the camera will be occlusion masked away during runtime  
(along with the specific 3D Line of Sight areas visible to the character,  
for example through the door on the left which would make the roof cull/mask out in the specific conical sight shape leaking into the room.**_

* * *

_**2)- The door on the top right should be in shadow/dark but the wall/roof/hatch above it should be visible according to angle of player character  
(in the use case example environment above):**_

> **[Mask Occluding Objects from Camera in Blueprints - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/mask-occluding-objects-from-camera?sessionInvalidated=true)**
>
> Masks out surfaces that block the camera from seeing the player character. Only affects what lies within a perimeter, leaving the rest of the mesh visible.

* * *

* * *

* * *

* * *

Addendum: Some links that maybe useful:

* * *

> **[Four Ways to Create a Mesh for a Sphere](https://medium.com/@oscarsc/four-ways-to-create-a-mesh-for-a-sphere-d7956b825db4)**
>
> Most of the geometric primitives like points, lines, triangles, planes, pyramids and cubes; are perfectly representable in modern graphics hardware. When graphics programmers face the problem of…

* * *

> **[UE4 Tutorial - Icosphere and Basic Tessellation](http://voxagon.blogspot.com/2015/05/ue4-tutorial-icosphere-and-basic.html)**
>
> Hello again, today I've finally finished my next tutorial. This one builds on top of my last tutorial about the custom mesh component so be...

---

<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 3, 2022, 7:48am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/18 "2022-06-03T07:48:24Z")

</div>

1. This is GR

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/e/0be056459e5ec9e42e9c03fd3d73d2452e1f713b.png)

1. For more traces, just change N

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/4/5c480ac5de9f1f14dcdc563a18194032af22dea5.png)

Reading the rest… This is a 3D version of what you have in Gyazo link.

---

<div class="post-metadata">

**Author:** ![Astrotronic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/astrotronic/32/1194566_2.png) [@Astrotronic](https://forums.unrealengine.com/u/Astrotronic)\
**Post date:** [June 3, 2022, 5:45pm UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/19 "2022-06-03T17:45:04Z")

</div>

Y’all are awesome! I just rolled this into a snippet:

> **[LineTrace in all directions | Unreal engine Code Snippet](https://dev.epicgames.com/community/snippets/dgR/linetrace-in-all-directions)**
>
> Pray, let us grok: Theta, Phi, Sine, Cosine
> 
> Credit: ClockworkOcean

It’s things like this that make the forums a great place to be. 🍻

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [June 4, 2022, 6:49am UTC](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/20 "2022-06-04T06:49:26Z")

</div>

So I created an actor blueprint and followed exactly but nothing happened.  
The actor doesn’t show any traces, what are the values for the Theta, Phi, Zoffset, and LenghtOfTrace? What am I missing here?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/2/3c287a696e6abf1b122ccb71e9b03539a5278bf8.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/3/ea3ef6ef9d9a28b9d146ee746ba388d9a1246159.jpeg)

[Next page](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301.md?page=2)
