Week 10: Project finalization

VR Escape Room Finalization

We tried many ways to make the buttons pressable, and only one way worked for us, which is by using animations. So we started by creating the animation, which is a simple change in the position of the button. 

Then, we only want the button to animate if the player presses it, so we need a trigger to start the animation.

After creating the button’s animation, we double click on the animator to get its window. By default, the animator will look something like this:



Which means that as soon as the button is instantiated, the animation will start. But we wanted to only start when the player presses it. So we replaced the default state of the button with a new empty state that we just created and we set it as default. Next thing is to create a transition between the new default state and the ButtonAnimation, and also the transition between the buttonAnimation and the default state, so, back and forth. We also create a boolean parameter to the animator to determine whether the button is pressed or not. And we add this boolean to the transitions. We set it to true on the transition from default to ButtonAnimation, and false accordingly.

Now we need a script to set the boolean to true and false, when the hands’ colliders trigger the buttons. See next script:


We also added to this script the logic of starting the water tap if the player pressed
the correct button.

For the water tab and the fire, we added sound effects. and in order to make it more realistic, we wanted to use 3d sound. To do that, first we downloaded and imported the Resonance Package from:
https://github.com/resonance-audio/resonance-audio-unity-sdk/releases/tag/v1.2.1’.
Once it was imported, we went to Project Settings → audio and we changed the Spatializer and the Ambisonic Decoder Plugging from none to resonance audio. Later we added the audio source to the respective models, we changed the spatial blend from 2D to 3D and checked loop. So that easy, the sounds became 3D, and interactive to the players position and distance from the sound source.

The player should be able to open the door after they get the key. 

For the door opening function, we first created an empty object in the upper left corner of the door, and then set the door as a child of the empty object, so that the rotation position of the combination of the two is the left axis of the door.
Next, we set the Trigger property of this combination and set the collider on the door, so that the door can be opened automatically when the key touches the door.
The following script shows how we applied that on the door.


Now we are finished working on the escape room and it's ready to be built and exported to the oculus quest. Here you can see the final result:



Comments

Popular posts from this blog

Week 4: Markerless Implementation and Finalisation

Week 3: AR Final Result