Control the Time of Day manually, simulate it at a given speed, or animate it from one time to another.
How to Setup (Time of Day Sample Level)
- Open the TimeOfDay level.
- Click on the ArcGISMap Gameobject in the Hierarchy panel.
- Set your API key under the Authentication section in the Inspector panel.
- Click Play and change the time of day using the settings panel.
How to Setup (Sample Viewer)
- Click Play in Unity Editor.
- Input your API key under the API Key Drop-down.
- Click the Sample Drop-Down and select Time of Day.
How it works
- Create a new C# script and make an HTTP request to query a feature layer.
- Create a new C# script
- Create a function that will store data returned from the Feature Query.
- Create a function to spawn the Feature gameobjects according to the data received in the query.
- Attach the ArcGIS Location Component to the Feature data gameobject.
- Add point lights to the feature items and set them to off by default.
- Create a C# script and add the following components to it:
- Directional Light for the sun
- Directional Light for the moon
- Sky and Fog Settings
- Calculate the time of day based on the rotation of the Sun/Moon in the scene.
- Create a canvas for the viewport so users can control the time using a slider or set animation properties.
- Set a time for the Point Lights to turn on and to turn off.
Note: You can use Debug.Log()
to print log messages in the Console window and see if you are gathering the data properly from the feature service.
About the data
Data for Boston Lamp Posts is fetched from a Feature Layerhosted by Esri. Data for Esri Global 3D Buildings Layer Elevation data is loaded from the Terrain 3D elevation layer hosted by Esri.
Tags
Feature Layer, Data Collection, Time of Day