Line Trace gives result from previous set of line traces

Hi, I’m using v4.7 P8 and I’ve been working on a trigger based cover system, where I’m trying to retrieve active cover and two adjacent covers (if any) upon a right mouse button event. For this purpose, I have created a new trace channel and new trace object to be used for cover traces and cover collision check. But before getting into collision, I decided to a trace check using right mouse button click to get any active cover in clicked location, and it’s two adjacent covers: one to left and one to right. I’m using a static mesh in trigger box to display cover when queried. Here’s what it looks like in action:

As you can see, my trigger boxes have arrows pointing towards cover mesh in order to determine cover direction. I use this arrow forward vector and then start line tracing by adding 45 degree angles to it, in order to cover a 360 degree angle roughly. first time it work well. If I click outside in any area with cover, all of these are hidden, arrays all cleared as well. So I made sure that there are no left over data from previous line trace every time I right click.

Now instead of clicking on any area without trigger, I go ahead and click on another cover trigger space. As per above logic, it displays active trigger and it’s two adjacent trigger. However it also displays last hit trigger from previous set of line traces. This means left trigger from above image, which happens to be hit last in previous 360 deg line traces, get added to result as well. Upon debugging, I found that my line trace locations are all correct and that this extra trigger definitely lies outside trace space. But it becomes visible somehow. Here its:

If I click on same location again, extra trigger is hidden, because now extra trigger will be based on subsequent line trace, which happens to be same as left trigger in above image. Since it’s already displayed, we don’t notice anything. But however if I right click back in first cover location, extra trigger becomes visible. Going through breakpoints, everything goes fine until line trace, even input locations, however first result in a set is retrieving some old value. debug lines do not go till extra trigger as well. I’ve gone through code many times, I’ve rewritten same code in v4.6, yet still facing same issue. It could very well be some logical error in my code as much as it could be a bug. So I’m willing to share code if you guys aren’t able to reproduce it.

Sounds like engine is not updating output of node. Try storing it in variables. Make sure to clear variable before line trace. That may not be solution but would signal what’s happening.

Yes, I’ve been doing that. I take hit actor and store it in an array while checking if array already has that actor or not. For first time in a new set of line traces, it always get last line trace hit actor from previous set of line traces. I’ve tried storing it in any additional variable as you suggested. I set variable to null before every line trace. I’m getting left over trigger for first time, even though line trace start and end locations clearly do not include it. I have to make some logical changes to adjacent cover array storage to include validity of trigger in relation to active context, but I’m unable to proceed any further without fixing this issue

This isn’t really a solution, per say, but rather a possible work-around(?)–have you tried, after right-click occurs and second set of triggers appear, to check location of trigger you entered and activated, and do another check to see if any results lie outside radius?

I feel like a secondary check, that checks distance via actor locations, discarding any that are out of it, may be a possible temporary solution

C; Right on

Thanks a lot Maverinox, I’ll go with that for now. I’m anyways specifying distance for forward vector multiplier, I can link that to check distance.

But I would like to see if there is some official fix, because line trace clearly seems to be giving wrong results in this particular situation.

Edit: Come to think of it, I will have to check distance to mesh to which trigger arrow points. If I don’t do that, it will create complications in certain situations where there are close by adjacent meshes. And doing this distance check might probably keep unwanted triggers out of context, unless there are some mesh positioning situations that I haven’t thought of.

Well, things got back to being weird again. No matter whether I’m clicking near mesh on right or left, it is referencing mesh from right upon line trace hit from trigger. This happens even when I remove left mesh and use a line trace of up to a 100 units from cover triggers on left, which clearly rules out mesh on right. I clear all arrays and set all mesh and trigger references to null at start of every right click. Yet it keeps going back to old references after hit result.

Edit: Even tried keeping a delay of 1 second after clearing references just to make sure that it was all taken care of before proceeding to line trace. But makes no difference.

Did someone eventually figure this out?
Just encountered same problem. line trace is clearly NOT hitting anything, but i still get a hit-return.

If i try to do a line trace somewhere else, and hit an object, refrence changes to latest traced object.

Any help would be greatly appreciated.

I haven’t checked on that after initial post. I’ll see if this is working in 4.7.2 and let you know.

Can confirm this, having same problem. I put result in variable, check current result each time against it and continue only if different.

Hi all,

I was able to reproduce this behavior in 4.7.5, but it appears to already be fixed in our internal build. fix should be included in a future release (probably 4.8 or a 4.8 preview). I’ve moved this post to Bug Reports section for tracking. If you see this behavior again after 4.8 release, please let us know. Thanks!

Many thanks. This is driving me crazy.

Thanks a lot man.

Hi crackboom,

Can you point me to GitHub version you used? Thanks!

I’m seeing this bug in 4.8 preview

Sorry, I don’t know github version. I’m a dev at zombie studios/hardsuit labs and I’m told we were able to get a 4.8 preview build from your perforce, and that we don’t know which revision it was. About section just says 4.8.0-0+UE4. That may not help, but thank you for checking up on it.

But upon some more testing, I may have been mistaken. problem I was seeing was that a Line Trace for Objects that I know was hitting nothing was still returning a Hit Actor of whatever previous Line Trace for Objects that did work. But I didn’t have a Branch for Return Value of Line Trace. Adding that branch gives expected behavior.

Ah, okay. That should be pretty similar to our Promoted branch from GitHub.

I tested this in our promotable from 10th, and Display Name given for a Hit Actor is null when there is no hit, regardless of using a branch. My setup looks like this for my trace:

If a similar setup is displaying a name for you, please let me know, or otherwise if you could show me your BP setup that could be helpful. Thanks!

I tried that exact set up and a name is still displayed when there is no hit. earliest date I have in our perforce is March 12, 2015, so maybe we got a version just before fix was in? But it looks like it is all good to go on your end, I have desired behavior for now on my version, and we’ll be upgrading anyway once real 4.8 comes out.

Sorry if this just created confusion, but I appreciate diligence!

It’s certainly possible it was fixed between March and April, but I’ll have to build March 12 version to double check. Glad you have it working how you need, for now! Please let us know if you still have trouble with this after 4.8, as well. Thanks!