Download

Line trace not working when starting inside static collision

Hello all,

I’m trying to familiarize myself with raycasts to check for collisions, but I’m running into problems.

Right now, I have a LineTraceForObjects that executes on event tick. It starts in front of my character’s face and traces a vertical line down to his feet (looking for static collisions). If my character is standing next to a step, the trace returns true, and the hit value tells me how high the step is.

GoodTrace.jpg

However, sometimes my line trace starts from inside a static object, and I get a bad hit value when the trace tries to exit the object. Is there any way to tell if a trace is starting inside a collision object?

BadTrace.jpg

I’ve been digging through the forums and the UE4 documentation, but I haven’t found any solutions. Any help would be greatly appreciated.

Thanks in advanced!

On your linetrace node, there is an Boolean parameter “Trace Complex”, if your expecting the raycast to start inside geometry, turn this on.

That solved it! Thank you so much for taking the time to help me. Everything is working perfectly now.