[4.7.6] - Line Trace Sometimes Fails

Hey ,

Thanks for the detailed update. I’ll give this a shot this week and see if it helps the issue I am having.

I’m curious, in your test, did you use one of the default levels or the one that came w/ the 3rd Person Template? I’m not 100% if I remember if that temp level has a BSP for the floors and walls but I’m curious if maybe it has something to do with a StaticMesh sitting on top of a BSP Brush. It’s a wild guess and probably a shot in the dark but you never know.

I’ll try this out and thanks again for the support , really appreciate it!

I’ll reach back out to let you know how things go, take care.

I have something else you should try adding to your existing code.

First, try adding the following line and see what kind of results you get:

DrawDebugLine(GetWorld(), FocalPoint, Directed ? EndLocation : EndPoint, FColor::Yellow, true, 5.f, 0, 1.f);

This should draw a line that displays your line trace. When I first did this I was getting nothing but horizontal lines, so that means that the Z axis wasn’t being accounted for in the line tracing. To get around this, I made a bit of a modification to your code to do this.

Wouldn’t fit here, so a pastebin link for you: http:///TuhetkGp

As far as using BSPs with line traces, I’m not sure how they react to line trace. I’m using the First Person Shooter template map, and using the static meshes. I’ll continue testing with BSPs a bit tomorrow and let you know what I find.

Much appreciated ! I was wondering how you do show a trace in C++. This is awesome and will help me get a better idea of what is happening.

Awesome, I will definitely see how this works out and fingers crossed. Thank you very much for the help on this one, I feel we’ll get this one figured out shortly! :slight_smile:

I should be able to test this out by Monday and get back to you between now and then w/ an update on the latest on how your code turned out and also how the debug traces are showing within the editor.

Thanks and if we don’t speak until Monday, have a great weekend and keep up the great work.

Hey ,

Just wanted to let you know I’m going to be jumping in and investigating this within the next hour. I’ll keep you posted buddy.

Okay ,

Did some testing w/ your code. I noticed in your code at least, the line trace seems to start above the characters head and not be 100% w/ the center of the screen.

That’s okay since I can adjust that but I noticed the same issue. If you load a New Level and select not the empty map, but the one w/ the BSP floor and Sky Dome, it still unfortunately fails every other frame.

Go ahead and use the same code you wrote and on the Character’s tick, call the unit trace function and in the tick, output…

GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::, FString::Printf(TEXT(“Blocking Hit: %s :: Actor Found: %s”), Hit.bBlockingHit ? TEXT(“true”) : TEXT(“false”), Hit.Actor != nullptr ? TEXT(“true”) : TEXT(“false”)));

You’ll notice every other frame (only when aiming at the floor) does it fail. If you aim at the sky dome, it is perfect every frame. It’s only when aiming at the BSP floor.

I’ll try to address the jitteriness once our animator finishes our current character since I think it’s coming from how I’m using the walking animation to side step currently.

But thanks and let me know what you think. Here’s hoping you see the same result. Thanks .

You may be onto something with the walking animation. This is really perplexing, as the floor in the blank level that you’re mentioning is actually a static mesh (You can check this by look at the icon beside the name in the World Outliner.)

The debug message you have set up should actually always return false on an actual BSP however as BSPs are not considered to be actors. I’m still unable to get this issue to occur but try messing around with the distance that the line trace is traveling. Another staff member I was consulting was mentioning this as it could cause some issues when really close to an object, as you would be with the floor.

Hey ,

Ahhhh. That’s right, it is a StaticMesh and not a BSP… I completely forgot that one. Try this… I’ve posted a w/ the character base code. It may help you lock it down.

As a note, I tried the distance earlier and now have it set to 10,000 :stuck_out_tongue:

Here is the code…

Does the issue still occur if you use the character class from the first person shooter template, or anything other that this custom class you made?

Great question! I will test this out. Today I am going through the upgrade process and getting everything in line for 4.8.

What I’ll do is (likely before week end), is give this a shot once I’ve upgraded us as well as go back and test it again to see if the new release helps.

But I’ll try this and maybe this will help me nail it down further.

Thanks again and I’ll keep you posted on my progress. Congrats on the 4.8 release to you and the team!

Have you been able to work on this any further? I’d be interested to see if you’re still experiencing the issue or if anything has changed.

Hey ,

Just replied on another thread. I’m going to be spending time getting caught up on all the AnswerHub responses so I’ll get you some results today. Things got really busy on the 10th then vaca/E3 and I couldn’t get to testing it out but I’ll get this evaluated very shortly here and try to get back to you within the hour on this one. Hang tight and appreciate the patience.

Alright ! I got great news. You guys resolved the issue in 4.8.0!!!

Now it makes some of my testing more accurate. I just tested on a level w/ a StaticMesh floor and it didn’t seem to go back 'n forth this time and also tested w/ a Landscape and a BSP. The BSP test failed as expected and stayed false, the SM was true and didn’t flip flop as well as the Landscape.

Awesome job! Maybe while looking for the issue, one of the devs made some code changes but it’s definitely not doing the same thing anymore. :slight_smile:

As far as the trace that seems to jump around, on the custom character I have some code to make him strafe using the current animation and I think (since the trace is based on characters position), it is causing some of that since the anim seems to be a little jittery as well.

We have an animator on this project who is getting a new Hero Character ready to be brought into the editor so after we pass that phase, and if we run into anything in particular, then I’ll reach out to the Support Staff and check in.

But cross this one off the books, great job to you and the team!

Glad to hear it. Please let us know if the issue returns or if you need any more assistance in the future.