Hide Multiple Objects With Single Raycast

Good day and thank you for taking the time to help me with this problem I am having.

Goal: So what we are trying to do is dary a ray cast from the camera to the player. Any object that is hit by this raycast will have it’s visibilty set to off. This is so the Player can always see their character, and so that the camera is never moved or jerked around without the player.

Issue: So the problem I am having is with multiple objects in front of each other.

What I can have happen is the one of these two walls will turn invisible, but the second one will not. If we rotate the camera it will almost “toggle” between the two, making the new wall hit invisible, and the previous wall visible. Ideally what should happen is when both walls are hit like in the previous image, both walls turn invisible, and not just the first one hit.

This is my current raycast blueprint.

As of right now I am only trying to make a “Wall_BP” Invisible, so this is all I need to currently cast to.

I have tried using the Multi Line Trace and using a ForEachLoop to cast to the walls, but this seems to have the same effect as the single line trace.

Thank you again for your consideration and time. If more details are needed I can provide.

Use the MultiLineTraceByChannel node, which will return a vector of hits, instead of just one:

239899-help.png

Use Multi line trace by channel like gancasmage said then for loop from the array, break the hit and trigger your “raycast hit” function