Skip to content

Creating New Scenes and Animals

Jasmine Mai edited this page Aug 26, 2020 · 15 revisions

Creating New Scenes and Animals

There are a few things you need to think about when creating a new scene or animal:

  1. Vision: What vision effects does each animal support? You may need to adjust world objects, the skybox, or the camera to apply different effects and show all of the different vision capabilities.
  2. Movement: What is the movement of the animal that is native to the environment? Currently, we are not switching movement types when users switch visions, so all visions will have the same movements.
  3. Sound: Does the sound in the environment differ based on animal?
  4. Lights: Do the lighting settings on the lights need to change depending on which animal vision is presented?

Creating a New Scene

Core Prefabs

Create a new scene in Unity. There are a few prefabs that every scene should have. These are:

  • OVRCameraRig: Found under Assets > Prefabs > Core. This is your main VR camera and allows the player to see in VR and also contains the models for the Oculus Touch Controllers.
  • InputManager: Found under Assets > Prefabs > Core. This is a wrapper for the OculusSDK that manages inputs. There are is a function that allows you to attach callbacks when certain buttons are pressed/touched.
  • AnimalManager: Found under Assets > Prefabs > Core. This is in charge of switching between animal prefabs. You need to drag in the specific animal prefabs that this scene supports
  • Animal Prefabs: Found under Assets > Prefabs > Animals. These are game objects that contain the vision and movement information for an animal. Animal Prefabs should include AnimalController.cs and AnimalVision.cs scripts. In the inspector for the AnimalVision.cs script on each animal, choose the vision effects and movement that you want to apply for that animal. You should add these prefabs to your scene then drag them into the AnimalManager.cs script on the AnimalManager prefab.

Other Prefabs To Consider

  • SkyboxManager: If your skybox material needs to change when your animal changes, you need to have the Skybox Controller prefab in your scene. Found under Assets > Prefabs > Vision
  • RendererManager: If you have an animal vision that requires renderer effects, you need to have the Renderer Manager prefab in your scene, with the applicable renderer effects scripts attached to it. Found under Assets > Prefabs > Vision
  • Teleport: The main way to navigate through scenes is usually teleportation, so if your scene supports teleportation, you need to have the Teleport prefab in your scene
  • Fly: If one or more of your animals can fly, you need to have the Fly prefab in your scene

Vision

There are three types of vision effects that are applied: renderer effects, material effects, and skybox effects. Renderer effects are applied to the camera and Material Effects are applied to environment objects in the scene. Skybox effects are applied to the skybox material and are controlled by the SkyboxController.cs script. More information on vision effects is here.

Material Effects

To add a material effect on an object in the world, make sure the game object and/or its children have renderers. Add a MaterialController.cs script to the gameObject. Then add the specific material effect scripts that you want this object to support (e.g. UV.cs, MaterialSwap.cs). Change the specific parameters as needed on these scripts.

Renderer Effects

Renderer effects are vision effects that alter the rendered image created by a camera. To add a renderer effect to a scene, first ensure the scene contains a RendererManager prefab. On the prefab, add scripts for any renderer effects you want the scene to support. (For example, if you wish to include a colorblind effect in the scene, add the ColorblindEffect.cs script to the RendererManager). These effects will be automatically applied to the camera whenever you are using an animal vision with the associated vision effect.

For more information on the Custom Universal Render Pipelines, read this.

If you want to create a new vision effect, make sure you follow the steps here.

Movement

You need to make sure that you set your world objects to proper layers so that things that can be teleported to are set on teleportable layers.

Sound

Check the audio sources in the scene and consider if their settings need to be adjusted if an animal is switched. For the audio sources have settings that need to respond to animal switches, attach a SoundController.cs script (found in Assets > Scripts > Environment) to the game object with the audio source and adjust the relevant settings on the script.

Lights

Check the lights in the scene and consider if their settings need to be adjusted if an animal is switched. For the lights that have settings that need to respond to animal switches, attach a LightController.cs script (found in Assets > Scripts > Environment) to the game object with the light and adjust the relevant settings on the script.

Creating a New Animal

If you need to create a new animal that is not currently supported by the project, here are the steps:

  1. Add your animal name to the Animal enum in AnimalEnums.cs
  2. Create an empty game object.
  3. Add AnimalController.cs to the game object. The required AnimalVision.cs script should be added automatically.
  4. Through the inspector, change the animal on AnimalController.cs to your new animal.
  5. Adjust the parameters on the AnimalVision.cs script. If you find that you need to create a new vision effect, read this.
  6. Add the game object to the list in the AnimalManager.cs script on the AnimalManager prefab through the inspector.
  7. Check the world objects in your scene and make sure that they properly support the material effects you need.
  8. Check the RendererManager prefab (probably located under the Vision game object in the scene) and make sure you have attached the renderer effects scripts that you need.
  9. Check the SkyboxController and make sure it supports the effects you need.
  10. Check the lights and audio sources in your scene and make sure the ones that have settings that need to respond to animal switches have LightController.cs and SoundController.cs scripts on them, and that you have added the settings for your animal.

Make sure you drag this new animal game object that you've created to Assets > Prefabs > Animals so that it will be a prefab that you can easily reuse throughout the project.