1. Prepare the project.
2. Configure Camera.
3. Configure Simulator.
4. Configure environment.
5. Preparing for animation.
6. Working with animation.
7. Final result.

Prepare the project.

Today I am going to describe you how to create VR project and add here Sunset/Sunrise using only the animation.

First of all, let’s create a project and install here the following:

Configure Camera.

Before we start with camera configuration we need to remove a camera which was created by default. Then put [CameraRig] from SteamVR to Hierarchy.
And remove or disable left and right hands. They are not essential for now.
After this select Camera(ears) and drag [CameraRig] to Vrcam property.
And one more thing is extending of our horizon line, because some things can disappear due to the limit of the eye view. To be more clear I highlighted with red circle on the screen below.

Configure Simulator.

From _ImmerseumSDK choose [VRSimulator] and put to Hierarchy also. This allows us to test application in Unity like we are using HTC Vive.
Now let’s move to the configurations of the simulator. Select VRSimulator → HMD Simulator script → CameraRig property and move here [CameraRig] object.

Configure environment.

Put some terrain on scene. To make it easier you can download Realistic Terrain Collection Lite and use them.

Create new GameObject and call it SunPivot. Then take DirectionLight and put it inside of the new created object. Put SunPivot somewhere in the center of terrain. As you can guess the SunPivot will be the center point of rotation. Now just move DirectionLight by axis X, where your horizon line will be.
I demonstrated on the next screen how it should looks eventually.
Additionally, it would be good to add one more DirectionalLight and call it just AdditonalLight, this will help to see smth when the dark will come.

And one more thing, you also need to check Skybox configuring.
Open Window → Lighting. I left default skybox as it is and put the DirectionLight to the property Sun, you can see in the screen below. Also it is better to uncheck property Auto to avoid backing of scene every time when you make changes. Please review the following screen.

Preparing for animation.

Before working with animation we need to create new folder in Assets. Let’s call it Animations. Here you can store all animations with their controllers.
Then follow next steps:

    1. Choose the SunPivot
    2. Then open Window → Animation
    3. Click button Create and save to the Animations folder with name SunAnimation and it’s controller, which will be called SunPivot as your selected object in Hierarchy.


    4. If the Animator wasn’t added to the SunPivot do it manually. Be sure that the controller is also appointed.


Working with animation.

Now we are ready to work with animation.
Select the SunPivot and in the window Animation you can see:

  • The number of samples which you can change as you need.
  • The chosen animation
  • Add Property button. Click here and choose Rotation by clicking +.
  • canvas-2
    To start animate you need :

  • Click red circle button
  • And start adding keys. On the beginning setup rotation values to x:0 y:0 z:0.
  • Move red line to the end. Add keys. And setup values to x:0 y:0 z:360.
  • To check how the animation works just push Play button.
  • canvas-3
    To manipulate with speed of animation you can go to the Window → Animator and change there the Speed property.To make it faster I changed speed from 1 to 0.1.

    Final result.

    Please review final result. Also here is link on the full sample.

    Feel free to make comments and ask questions.