Download

What Rotation should have global directional light for midnight?

Actually this is the whole question. I connect sunlight with FTimespan struct of current day time and get the turnrate in event tick event with this algorithm:

float AEnvironmentManager::GetDayNightTurnRate(const FTimespan& DeltaTimespan) {
	constexpr float SecondsPerDay = 86400.0;
	constexpr float FullCircleDegrees = 360.0;
	float DeltaSeconds = DeltaTimespan.GetTotalSeconds();
	return (DeltaSeconds / SecondsPerDay) * FullCircleDegrees;
}

Then I just AddActorLocalRotation with FRotator (turnrate, 0, 0); But I need to setup directional light to equivalent 00:00 time for sinc global time and global directional light. Seems initial setup with FRotator(0,0,0) not correct in this scenario.