# I need my line trace to detect Multiple walls and hide all the walls that have been detected

**URL:** <https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342>\
**Category:** Blueprint\
**Tags:** unreal-engine, InsideUnreal, Blueprint, question\
**Created:** [November 13, 2024, 3:30pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342 "2024-11-13T15:30:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dante101010](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dante101010](https://forums.unrealengine.com/u/Dante101010)\
**Post date:** [November 13, 2024, 3:30pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/1 "2024-11-13T15:30:52Z")

</div>

![1 - Timer By Event](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/2/79228d3a323b415861d99e97624fd8e4dd8c7873.png)  
 ![2 - Line Traces](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/3/933518288c951c67d4057ac3146fe50e9e7d3271.png)  
 ![3 - Invis or vis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/c/d2c07dc5600c11fdaaf0957859b1653f04f6a71e.png)  
 ![Full View](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/3/e43bb24c22e3c6c9a5589c3ebaebf0109573897c.png)  
 ![Variables](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/8/e/78e1d7ab96e69d0ec9c187364738837323810449.png)

Hey yall,

I have a very important question. I am using a line trace to try and detect multiple meshes in my scene and hide them all at the same time when the line traces hit the objects. When the line traces are not hitting the objects, the objects need to return to full visibility. I am not sure what I am doing wrong but I can’t get it to behave correctly.

I can successfully get it to do the first part (Hiding objects) but cant get t to accurately reveal all the objects that are no longer inside the line traces.

I have attached several images of the process that has been followed

Does anyone know what I should do?

---

<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:** [November 13, 2024, 3:56pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/2 "2024-11-13T15:56:41Z")

</div>

Have you tried turning debug on for that trace? I think it might be most of your problem. What are you trying to do, a sort of fan trace?

Not quite sure what you’re heading for with the arrays. If you just want to unhide what you’re not tracing to, you can use a variable. But it’s worth using two arrays if you unhide happens at a different rate to the hide, like

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/0/060ae7694614e55bec88c167e0532c6f98c9a574.png)

![hide](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/8/b68ecb7acfeb9cb31a6fc4386dbbfbf22e5a1aaf.gif)

---

<div class="post-metadata">

**Author:** ![Dante101010](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dante101010](https://forums.unrealengine.com/u/Dante101010)\
**Post date:** [November 14, 2024, 2:49pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/3 "2024-11-14T14:49:23Z")

</div>

> [@ClockworkOcean](#):
>
> are you trying to do,

Hi ClockworkOcean. Thank you for your reply.

Yes I am trying to create a fan of rays in front of my character which is suppose to work like a camera cull, culling all walls in front of the player. and when the walls are no longer inside the line trace fan the objects should be visible again

Something like the attached image : Sorry for the horrible drawing

 ![Line Fan Trace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/1/6b1ddc7c879ed00c21de25e4022e500b0798451f.png)

---

<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:** [November 14, 2024, 2:59pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/4 "2024-11-14T14:59:07Z")

</div>

Ok, so you can’t cull part of the actor, as you have shown there. Unless you do it in the material. Or this

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/2/10216ddfc41d03e02dac7a054f9339c273dac4da.jpeg "UE4 Object Mask l Unreal Engine 4.26 (Tutorial)") ](https://www.youtube.com/watch?v=wJgT9s_SQaU)

---

<div class="post-metadata">

**Author:** ![Dante101010](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dante101010](https://forums.unrealengine.com/u/Dante101010)\
**Post date:** [November 14, 2024, 3:48pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/5 "2024-11-14T15:48:44Z")

</div>

@ClockworkOcean , I forgot to mention that the walls are all separate modular static meshes.

 ![Modular Wall.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/c/fec7d9197bf03248f01898a687ca9e8fc3e1c995.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:** [November 14, 2024, 4:05pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/6 "2024-11-14T16:05:14Z")

</div>

Right. Imagine we have two arrays

Hit  
Clear

So, in each frame do this

Copy everything in Hit to Clear  
Empty Hit  
Line trace into Hit ( and hide meshes )  
Loop through Clear ( and unhide meshes )

I think that should do it 🙂

---

<div class="post-metadata">

**Author:** ![Dante101010](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dante101010](https://forums.unrealengine.com/u/Dante101010)\
**Post date:** [November 14, 2024, 10:29pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/7 "2024-11-14T22:29:24Z")

</div>

Hmm I tried, but I can’t seem to get it to work right.

---

<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:** [November 15, 2024, 9:04am UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/8 "2024-11-15T09:04:25Z")

</div>

Ok, first of all, let’s sort out the fan trace. This is a good way to do it

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

It should line up with your actor forward vector

![fan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/1/ee11fd992010c06afdb80620ec201cffbd2ab09c.gif)

Then, you can just use two arrays, like this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/8/728d5e2805307d15cad67c1fb31768b841ca5ee5.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/3/4930623295badbadd54cfd36d6536a6da542ba87.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/4/f44c69fc3db2c23a1575744d6a86ec34180ecd4b.png)

And you get

![viz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/8/c583a7570dc18014ac04fd50fa31c0c5140be524.gif)

You can’t walk through that gap, though. You would need to fiddle with custom collision settings for that. Also, one mesh can block you from hiding another, even when its hidden. Same problem.

---

<div class="post-metadata">

**Author:** ![Dante101010](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dante101010](https://forums.unrealengine.com/u/Dante101010)\
**Post date:** [November 15, 2024, 12:47pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/9 "2024-11-15T12:47:52Z")

</div>

@ClockworkOcean Wow! A true genius! Works perfectly.

Thank you for all your help!

---

<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:** [November 15, 2024, 1:03pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/10 "2024-11-15T13:03:17Z")

</div>

🕶 🖖

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 15, 2024, 1:03pm UTC](https://forums.unrealengine.com/t/i-need-my-line-trace-to-detect-multiple-walls-and-hide-all-the-walls-that-have-been-detected/2120342/11 "2024-12-15T13:03:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
