Book Image

Unreal Engine Game Development Cookbook

By : John P. Doran
Book Image

Unreal Engine Game Development Cookbook

By: John P. Doran

Overview of this book

Table of Contents (18 chapters)
Unreal Engine Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a Day/Night cycle


If we are creating an open world title or any kind of game where the player is outdoors, one thing that would be nice is the ability to have our world change the time of day at the same rate.

Getting ready

Before we start working, we should have a level created with a Sky_Sphere and a directional light (the default map has this). To be sure, you can use the DayNightCycle-Before map from the example code folder.

How to do it…

Perform the following steps to create a day/night cycle:

  1. As we discussed before, we can use Directional Lights to act like the sun. For our day/night cycle we will want our lighting to change over time, so let's select the DirectionalLightStationary object from the Scene Outliner tab and then from the Details tab, change the Mobility property to Movable. Finally, change the name of the object to DirectionalLightMovable.

    Note

    You can either rename the object from the Details tab or press F2 when selected in the Scene Outliner tab.

    Making our DirectionalLight...