i tried using HitResult->Normal and ImpactNormal to try to get the slope of the terrain at the trace point and both come up 0, i dont want chests to spawn on slopes over a certain steepness. Anyone know how to trace the normal of the terrain at trace impact?
EndTrace = FVector(SpawnLocation.X, SpawnLocation.Y, (SpawnLocation.Z - 500000));
if (World->LineTraceSingleByChannel(*HitResult, SpawnLocation, EndTrace, ECC_Visibility, *CQP))
{
AActor* HitActor = HitResult->GetActor();
if (HitActor->ActorHasTag("Ground"))
{
NewZ = HitResult->Location.Z;
NewLocation = FVector(SpawnLocation.X, SpawnLocation.Y, NewZ);
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, TEXT("Slope Normal: X:" + FString::FromInt(HitResult->Normal.X) + " Y: " + FString::FromInt(HitResult->Normal.Y) + " Z: " + FString::FromInt(HitResult->Normal.Z)));
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, TEXT("Slope Impact Normal: X:" + FString::FromInt(HitResult->ImpactNormal.X) + " Y: " + FString::FromInt(HitResult->ImpactNormal.Y) + " Z: " + FString::FromInt(HitResult->ImpactNormal.Z)));
}
}