Multi Sphere Trace Bugged?

My goal is to create a beam between two actors that breaks when vision between the actors is obstructed. For some reason the Multi Sphere Trace is capable of tracing through walls that I have set to block Visibility and camera traces. These same walls block regular line traces as intended. Furthermore the Multi Sphere Trace appears to randomly decide which angle an object can not be traced each time I load my game; sometimes the trace comes back false when I stand in front of the actor and other times I need to crouch or stand at the side.

At the start of this video I demonstrate a simple line trace and print string to show Visibility is blocked by nearby objects. I later use the line trace to show that Visibility is blocked yet Multi Sphere Trace manages to find the target or even decide not to when Visibility is available.

In this picture I show the Multi Sphere Trace that is looking for the actor the beam is connected to. This actor is stored as a variable when the beam is created upon a successful line trace to a pawn target. For this image I disabled the beam’s ability to destroy itself when Visibility is blocked but the Print Strings show visibility is never lost except when the Multi Sphere Trace seems to decide not to find the target actor.

Where do you clear “visible targets”? Ok, maybe you never have to because this piece of Blueprint is on tick?

I suggest you create a widget that permanently displays which target is currently targeted by your raycast.

Correct, my blueprint has other ways to clear the Target variable (distance from actor, energy available, ect). The issue I currently have is once the beam attaches to an actor there is nothing to stop the beam from maintaining connection through walls as seen in the video. I intend the Sphere Trace Tick to clear the Target if visibility is obstructed thus breaking the beam on an “is valid” check later in the blueprint.

For this troubleshooting I created this loop to tell me if the Sphere Trace is being blocked by Visibility or not without breaking the beam otherwise I’d have to re-trace every time it randomly decides to not find my target in a sphere trace. If a box or a wall occludes visibility between the two actors the Sphere trace is supposed to come back negative and clear the Target variable…unfortunately Visibility Traces from a Sphere trace does not appear to function properly. A regular Line Trace works 100% of the time as intended with Visibility channel, this Multi Sphere Trace does not.

If there is another way to check if the target player is visibly blocked by an object I’d like to hear about it. I’d rather never see the beam pass across a wall but Visibility tracing every frame is killer on the frames.

I need to see how the whole process works (start tracing, check trace and all the likes).

I can’t figure it out for now.

If this is not legible I’ll take the time to do some print screens and past them together

Ah ah :smiley:

I can’t really help you until you organized all of it. I don’t even know how you can debug this :stuck_out_tongue:

But from my experience, there is no bug with Multi Sphere Trace by Channel.

cleaned it up Link Gun Beam posted by Xnar | blueprintUE | PasteBin For Unreal Engine

I also took the liberty of setting the Multi Sphere trace to the way I intend it to function; located on the far right side of the graph. The sphere trace will periodically check if the Link target is in line of sight. In the event the sphere trace returns negative it will try again after two seconds in which case the beam will destroy itself if the Link target is negative a second time. The problem I have is as seen in the video in the OP, the Visibility Trace does not seem to work or be reliable for the Sphere trace; Sphere Trace is able to trace through walls even with Visibility blocked as demonstrated by the Video’s line trace.

I may be mistaken, but when you trace by visibility it is actually looking for actors/objects that are set to visible in the engine, not by LoS. I would do it by a line trace from the players location to the target location and if there is any obstructions, break the link. Also (may be wrong about this as well) why not add the object to your “visible targets” array and clear it later? From the looks of it, your array variable is being over written by the last object it finds in the sphere trace. So there is only one object in the array when you get to the “contains” check. Im at work right now, so I cant test it, but I think these are the issues you are running into.

…omg I you’re correct.

^ this will definitely be the solution to my issue. Start the Line trace at my Actor’s location and the End trace at the target Actor’s location. For whatever reason my brain was fixed on the idea the Line trace always pointed with the camera smh

Finished Product. Problem Solved. Thanks so much for the help and enlightenment. Link Gun Beam posted by Xnar | blueprintUE | PasteBin For Unreal Engine

Glad I could help :slight_smile: