Final Project

Final Project


It was a long and winding odyssey, but I present to you the screencast of my final project (Note: Without the audio, this does not have nearly the full effect. If someone knows how to take a screencast w/audio, I would love to redo this):

If you have the chance, view the full file on Unity in the Innovation Lab, as audio plays a huge role in the story. *I do not own the rights to any of the music and as such this is for personal use only*

The reason I say this experience was an odyssey is because originally, I was going to do a 360 video on the IMAX dome at the Museum of Science and Technology in Syracuse. I showed up and got some really interesting shots, did an interview, set up the camera in a couple of intriguing locations. I wanted to start editing the footage, so I took the microSD card out of the Gear 360 I used and put it in one of the card readers Newhouse provides. Big mistake. I tried to adjust it, and the SD card got stuck in the card reader. As I tried to lodge it loose and pulled, the card snapped into pieces. I could not believe my eyes; I have never seen anything like this happening. I left the pieces of it in the top right glass shelf in the I-Lab because I know if I didn't see it, I would have trouble believing it. The experience was absolutely bonkers. Compounding my problem, I only had about a day left in Syracuse.

I ruled out reshooting the 360 video, and against some of my better judgement (and the advice of a couple of people), I decided to do a Unity scene. This let me do the project on my terms and without the need for external equipment prone to freak accidents. However, I am not exactly what you would call gifted with Unity, and I knew this going in. I am pleased with the final result though.

I spent about six hours trying to do a Unity scene in the I-Lab my last day in Syracuse, but I could not get Playmaker to work. Jackie Prager graciously spent some of her time studying for finals helping me with the scene, but we still were not able to make it work, even using the same logic as she did. We had a couple of problems, primarily moving objects that were not the FPS Controller. I tried to make a Minotaur guide you through a beachside barbecue (why not I guess). Essentially, I tried to trigger the Minotaur to teleport to where the FPS was, and then walk together to the beach. My logic for the first bit was sound, as it progressed through all of the FSM states as it should have, but when it got to the finished event, the system would exit the FPS view for some reason. If anyone has ever encountered this problem, I would love to hear your thoughts.

After that debacle, I decided to just download Unity on my Mac so I could just work on it when I went home. I started to scan my childhood for ideas. I always loved the Triwizard Tournament in The Goblet of Fire, so like the great J.K. Rowling herself, I lifted the idea of a maze from her, complete with a portkey at the end! This maze doesn't involve death but instead fun music selections from the 70s and 80s! The maze will also let you know sometimes if you've hit a dead end. In this process, I figured out how to do two things I hadn't been able to do before: get sound to play only when you want and in a certain area, and to teleport through the scene!

Sound: I know that lots of my fellow classmates have had the same struggle I have with how to get different songs and sounds to play exactly where we want them when we want to. I more or less figured out how to do it, but it took me a bit of coding to do so. If the thought of coding scares you away from doing this, don't worry; I have almost zero experience with coding, yet I found that I could figure it out easily. After searching the internet for a while trolling through different websites for ideas (including a dead end script with C#), I found a blogpost from someone who had encountered a similar problem and fixed it with a Javascript. Bless who ever it was for including pictures, as I have done below, otherwise I would not have been able to figure it out. By modifying the script based on trial and error, I figured out how to get it to play only when I wanted to.

Here is a step by step explanation of how to play sounds when and where you want them:

  1. Create a cube, place it where you would like the sound to play, turn off the Mesh Renderer if you want the cube to be invisible, select box collider and make sure the "Is Trigger" box is checked. Adjust size of collider to your needs.
  2. Next, add a component by either going to the window Component at the top of the browser or scroll down on the Inspector to the right of your screen and click on add component. In both scenarios, add an Audio Source component. For the AudioClip, select the sound you want (either import a song or Youtube video or get one from the Assets Store). Make sure you deselect Play on Awake, otherwise it will just play throughout the whole scene. Set the Spatial Blend to 3D, and select a distance and manner in which you would like the sound to play. I preferred a linear rolloff to allow the sound to fade smoothly as you get further away from it, as opposed to the logistic rolloff which is more abrupt. Below is a picture of what my Inspector for my AudioSource looks like, featuring the Guns & Roses hit classic, Welcome to the Jungle:

Screen Shot 2017-05-09 at 12.54.48 AM

3.  Somewhere within your Assets in your Project, right click and select Create: Javascript. I have included a picture of my script below, but there are a couple of important things to note before starting. Where it says 'var' and then something after it (in my example plzwork lol), that word after it is your variable, and you need to create a new one for each sound you create. Also, I found that sometimes just copying the script into a new script for a different noise, as opposed to typing it all in, did not work when played in FPS. With that said, here is a picture of my script: Screen Shot 2017-05-09 at 1.06.02 AM

4.   Either drag the script on top of your cube in the Hierarchy tree to the left, or add another component, select script and select the corresponding one. A window in Inspector should pop up, with the name of your script at the top and below it, and the name of your variable at the bottom of the three. Across from your variable, once again select the sound you want as the AudioSource.Screen Shot 2017-05-09 at 1.14.20 AM

By changing your rolloff, the minimum and maximum distance and the size of the box collider, you can effect when the song is played (through triggering of the box collider), how long it plays and how far it can be heard (both through the distance and rolloff). For example, by setting the box collider size to just one, I could get the music to play as soon as you walked through an area.

Teleport: Jackie Prager has written on this subject before, but I have some things to add. Essentially, I was only able to transport the FPS throughout the scene with the Playmaker action Move Object, not I Tween. For whatever reason, I Tween did not work with the FPS. The version of Unity on the Mac in the Innovation Lab did not have Move Object; I am not sure why. The logic is pretty basic. It is just two events, with three total transitions. Create an FSM on a cube from where you want to transport from. Add your first state and name it Trigger Event, or something similar. Your other state should be named whatever is you want to happen (for example, teleport). In the first state, create a transition and select "TRIGGER ENTER". In the second, create both a "FINISHED" transition and a "TRIGGER EXIT" one. In the second state, select action browser and 'Move Object'. Specify the game object as the FPS and the destination as whatever cube you want to teleport to. Set the time and speed to zero (not none), and specify the finish event as "TRIGGER EXIT". This should allow you to move the FPS wherever you want within your scene. Here is a photo of my logic:

Screen Shot 2017-05-09 at 2.21.10 PM

No related post

COMMENTS

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.