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

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?

1 Like

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

hide

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

1 Like

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

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

1 Like

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 :slight_smile:

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

1 Like

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

It should line up with your actor forward vector

fan

Then, you can just use two arrays, like this

And you get

viz

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.

1 Like

@ClockworkOcean Wow! A true genius! Works perfectly.

Thank you for all your help!

1 Like

:sunglasses: :vulcan_salute:

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