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 the active cover and the 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 the collision, I decided to a trace check using right mouse button click to get any active cover in the clicked location, and it's two adjacent covers: one to the left and one to the right. I'm using a static mesh in the trigger box to display the cover when queried. Here's what it looks like in action:
As you can see, my trigger boxes have arrows pointing towards the cover mesh in order to determine the 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. The first time it work well. If I click outside in any area with cover, all of these are hidden, the arrays all cleared as well. So I made sure that there are no left over data from the 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 the above logic, it displays the active trigger and it's two adjacent trigger. However it also displays the last hit trigger from the previous set of line traces. This means the left trigger from the above image, which happens to be hit last in the previous 360 deg line traces, get added to the result as well. Upon debugging, I found that my line trace locations are all correct and that this extra trigger definitely lies outside the trace space. But it becomes visible somehow. Here its:
If I click on the same location again, the extra trigger is hidden, because now the extra trigger will be based on the subsequent line trace, which happens to be the same as the left trigger in the above image. Since it's already displayed, we don't notice anything. But however if I right click back in the first cover location, the extra trigger becomes visible. Going through breakpoints, everything goes fine until the line trace, even the input locations, however the first result in a set is retrieving some old value. The debug lines do not go till extra trigger as well. I've gone through the code many times, I've rewritten the same code in v4.6, yet still facing the 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 the code if you guys aren't able to reproduce it.
I was able to reproduce this behavior in 4.7.5, but it appears to already be fixed in our internal build. The fix should be included in a future release (probably 4.8 or a 4.8 preview). I've moved this post to the Bug Reports section for tracking. If you see this behavior again after the 4.8 release, please let us know. Thanks!
answered Apr 14 '15 at 07:44 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here