# What Rotation should have global directional light for midnight?

**URL:** <https://forums.unrealengine.com/t/what-rotation-should-have-global-directional-light-for-midnight/241688>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [July 20, 2021, 4:18pm UTC](https://forums.unrealengine.com/t/what-rotation-should-have-global-directional-light-for-midnight/241688 "2021-07-20T16:18:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_818a9657](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_818a9657](https://forums.unrealengine.com/u/anonymous_user_818a9657)\
**Post date:** [July 20, 2021, 4:18pm UTC](https://forums.unrealengine.com/t/what-rotation-should-have-global-directional-light-for-midnight/241688/1 "2021-07-20T16:18:40Z")

</div>

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:

```auto
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.
