Hi, I’m trying to align a spline onto the surface of a landscape by using landscape->ActorLineTraceSingle() to get the Z location on the landscape at all the spline points. However, though all the spline points are near the surface of the landscape, most of the spline points are not exactly on the surface.
Is this supposed to happen or am I doing something wrong?
The following is the code I’m using.
FCollisionQueryParams collision = FCollisionQueryParams(FName(TEXT("trace")), true, this);
if (landscape != nullptr && landscape->ActorLineTraceSingle(hit, FVector(x, y, 100000), FVector(x, y, -100000), ECC_Visibility, collisionParams))
{
z = hit.Location.Z;
}