Download

Alternate for trace test on landscape(trace and sweep bugged)

My pawn is like a snow sledge I need to detect when its bottom touches the landscape…

Initially I tried to do it using trace/sweep but they are horribly bugged.
Related AnswerHub post :- Trace and sweep on landscape horribly inaccurate - UE4 AnswerHub

Another work around I imagine can be done using a boxs on the bottom and detect when it overlaps with the terrain. But the problem with this is I wont be able to detect the exact location where the trace hits the ground. I can probably do with it but it would be better if the trace if fixed.

Another method is using a set of nested boxes and detect which box overlaps but it kind of feels like a clumsy work arround to this.

Have you tried something like slightly changing the start of the trace yet? The start might be too close to the landscape or even beyond that so that it cannot detect anything.

Something like


FVector TraceStart = <whatever computation you have already>;
FVector TraceEnd = <whatever computation you have already>;

//slightly modify TraceStart so that it is hopefully not as close to the landscape anymore and intersections will be detected properly
//moves TraceStart 10 units further away from TraceEnd while maintaining the same direction of the trace
TraceStart = TraceStart - (TraceEnd - TraceStart).Normalize() * 10.0f;

<perform trace>;

You may have to add your sledge to the ignored list so that the trace doesn’t immediately hit that instead.

yeah it is a bug I also reported. when I need to use vertical tracing I use a little xy offset to not match landscape vertices, because I found not sensing the surface properly along the x axis.
when I use it for my characters to keep them on ground, I use a non-vertical trace that works (start xyz: actor middle, end xy: target movement location, end z: actor feet minus some value)

Yes have done both. The start is well over the landscape and the sledge is ignored.

Although I found a work around. Changing the thickness of the landscape does seem to help.