Issues with single line trace, barely ever works.

So I have a single line trace that starts from the player location and ends where the mouse points in world space. The issue is that most of the time the line trace fails for no real reason, sometimes it’s as easy as moving the mouse a pixel to the left and sometimes it refuses to work at all.

This is the blueprint for the trace.

And this is how it can look sometimes when I try it.

Do anyone know what’s causing the issue? Because I have no idea at all. The world location and mouse location does get updated, it’s just that the trace fails. I’ve tried different traces and the same thing happens and I’ve tried object trace instead of channel trace and it’s the same thing there too. Everything fires and works as I’ve got print strings to check if the trace worked or not. From what I can tell it does seem that tracing to static geometry instead of the landscape do have a higher success rate.

Are you firing the trace with a tick event or a timer?

You need to make your end location slightly longer than what it needs to be. That should decrease the chance of it failing.

Thanks, now it seems to always work. Maybe EPIC should add an option for allowing the trace to continue a few units in the trace node. I’m not sure if my way of doing it is actually correct, but hey it works. I’m just posting in case there would be some issues with it.

You could take the impact normal and times it by a negative number and add it to your location. That should do the same trick.