Initial Post: https://alternaterealities.nyuadim.com/2019/03/04/project-2-storyboard-claire-junior-atoka/
Development Blog: https://alternaterealities.nyuadim.com/2019/03/20/development-blog-project-2-interactions/
In retrospect, creating and implementing the interactions for this project was definitely a worthwhile experience. Learning to teach yourself a new software is definitely a realistic expectation of someone’s professional career and this project provided an excellent testing ground for such expectation. However, there where several unexpected mishaps that intervened with the project’s complete fruition as well as major moments of success and I will explain such in the following paragraphs.
- SteamVR
SteamVR repertoire of scripts and prefabs allowed me to implement the grabbing of the glasses really easily. However, my initial approach to create the change of camera blurr was to modify the scripts that came with SteamVR. However, this scripts are overly complicated and not easily readable which resulted in me just messing up this interaction in my efforts of implementing additional functionalities to the game.
Another problem that occured whenever I was working on my project was that Steamvr stopped working unexpectedly. This was an unexpected bug that forced me to create an entirely new project file, export all files (expect the SteamVR plugin) from my original project to the new project file, and then install and import a new SteamVR plugin into my new project file.
- New Scripts
Given the issue with Steam VR and its closed system that doesn’t allow for a modification of its scripts, I decided to create four new scenes with different colors(Atoka’s idea) and glasses. This resulted in a modification of our projects initial idea, as well as a different functionality. The user now has to look for the glasses, and once they find them, they will be transported into an entirely new scene with misplaced glasses located in an entirely new place. The user must now find the glasses in each scene, and then at the end, the will end up in a new scene with corrected vision. In order to change scenes,I used Unity Scene Manager library. I created four sceneswaps scripts and I attached one to each pair of glasses.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class sceneswap : MonoBehaviour
{
// Start is called before the first frame update
public bool changed;
public string[] scenes = { “Bathroom7Blue”, “scene1”, “Bathroom7Green”, “Bathroom7Red” };
public float initz;
public float currentz;
public Scene currentscene;
void Start()
{
currentscene = SceneManager.GetActiveScene();
initz = GameObject.Find(“Glasses1”).transform.position.z;
changed = true;
}
// Update is called once per frame
void Update()
{
currentz= GameObject.Find(“Glasses1”).transform.position.z;
print(“currentz: “+currentz);
print(“initz:”+ initz);
if (changed==true)
{
if (initz != currentz)
{
Destroy(gameObject);
SceneManager.LoadSceneAsync(scenes[3]);
SceneManager.UnloadSceneAsync(currentscene);
//Application.LoadLevel(2);
changed = false;
}
}
}
}
Note: There are four scripts like the one above implemented in my project, each one for each pair of glasses that is linked to a particular scene.
At first, I wanted to modify the Interactable script so that the scene is swapped whenever the game object is attached to the hand. However, even though the change of scene was achieved through this approach, the flow of the code was interfered with which resulted in interfering with the Interactable Hover Events Script (the glasses wouldn’t stop glowing). The approach I implemented in the above mentioned script was to base the scene swap in the position of the glasses. Once the glasses were moved from their original position, the scene will change. I used the Game Objects Z value, but the x or y value would work as well.
Further Improvement
Even though both interactions were achieved, some things could been added in order to fully culminate tha narrative we wanted to achieve. Some sound could have been added by my partners. Also, maybe changing the camera blurr back to normal once the user goes to the last scene would have been excellent as well. All in all, I am really proud of the results of this project and what it came to be.