if (FMath::IsNaN(SunPitch) || FMath::IsNaN(SunYaw)) {
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Sun Pitch or Sun yaw is nan"));
}
else {
SunLight->SetActorRotation(FRotator(SunPitch, SunYaw, 0.0f));
}
// call of Sky sphere function
Valid = SkySphere->UpdateSunDirection();
MoonTrajectory();
if (FMath::IsNaN(MoonPitch) || FMath::IsNaN(MoonYaw)) {
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Moon Pitch or Moon yaw is nan"));
}
else {
MoonLight->SetActorRotation(FRotator(MoonPitch, MoonYaw, 0.0f));
}
FLatentActionInfo LatentInfo = FLatentActionInfo();
LatentInfo.CallbackTarget = this;
if (FMath::IsNaN(MoonPitch) || FMath::IsNaN(MoonYaw)) {
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Moon Pitch or Moon yaw is nan"));
}
else {
UKismetSystemLibrary::MoveComponentTo(Scene, Scene->GetComponentLocation(), FRotator(MoonPitch, MoonYaw, 0.0f), false, false, 0.0f, true, EMoveComponentAction::Move, LatentInfo);
}
// change material
if (FMath::IsNaN(SunPitch)) {
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Sun Pitch is nan"));
}
else {
MoonMaterialInstance->SetVectorParameterValue("MoonColor", SkyColor->GetLinearColorValue(UKismetMathLibrary::MapRangeUnclamped(SunPitch, 0.0f, -18.0f, 0.0f, 1.0f)));
}