Engine Version: 4.7.4
I am trying to figure out the height of the landscape at any given point and I use the line trace method for that. Unfortunately, it misses the landscape completely on some occasions.
I use these vector endpoint values to intersect with the landscape:
Start: -60.171597, 6648.526367, 1100.839844
End: -60.171597, 6648.526367, -899.160217
The landscape Altitude / Z value is 0 at this position.
I can repeatably miss the landscape on my level map by using these values in blueprints (Line Trace by Channel).
Just for fun, I tried the same values in C++ with the following code:
FHitResult hr;
UWorld* World = GetWorld();
if (World)
{
World->LineTraceSingle(hr, FVector(-60.171597f, 6648.526367f, 1100.839844f), FVector(-60.171597f, 6648.526367f, -899.160217f), FCollisionQueryParams(), FCollisionObjectQueryParams(ECollisionChannel::ECC_Visibility));
}
That also misses the terrain. I try to dig into the engine source, but the trace code uses PhysX code and that’s a bit beyond me. (\Engine\Source\Runtime\Engine\Private\Collision\PhysXCollision.cpp, Line 833)
I can upload the level if it helps to reproduce this issue.
My current work-around is to use a sphere trace which gives correct results.