Tuesday, November 5, 2019

Milestone 1 finished!

Video from the v1 of the project, overall it's still the same with some added bangs and whistles:


As I said in my other post I created almost all of the prefabs in tinkercad. The only assets that I imported from the Unity store are the cake slices, the grass tiling, and a metal & wood material pack, for the sake of time.
 The guillotine is made up of 3 parts in tinkercad: the wooden body of the frame, the blade plus the hanger and the wooden block that is between them. I did it this way so I would be able to use different material types in Unity.
The lever and base are two objects as well as I wanted to make them uniformed materials with the guillotine, to make it visually cohesive for the user. As well as I wanted to make the lever actually moveable within the base.
I added the three duplicated castle walls to create an environment for the viewer. This way it is not just a plane floating in endless space unless the user can find a way to glitch the camera around! Later I created the drawbridge because when I was originally creating in Unity I forgot about the VR camera!

The guillotine was first created with a mesh collider but I didn't find that the collider worked within the whole shape. Although I kept the mesh collider as I liked how it worked with some parts of the frame I also added a few box colliders as extra components. There are some thin ones around the opening of the headrest to help catch and stop the blade as it falls. There is also another across the bed so the back of the cake has a collider to interact with and does not just fall to the ground, giving away the illusion of a solid object.
The blade's mesh collider worked very well and is as thin as the blade itself, which is great! This meant that it can fit into the slot I created for it in the guillotine object and it's extra box colliders. I did end up adding a thin box collider to the parent blade so I could use that to trigger the cutting script.

Originally I was going to animate the falling of the blade with an animation timeline that I would connect to an OnTrigger event, I had seen this on a tutorial for another falling object on Lynda.com. I ended up having issues getting the timeline to register my clicking off and on of kinematic as was done in the tutorial I was following. Bryan helped me realize it would be much simpler to use a script that would turn on and off the constraints when triggered by a button press.
Later I also had Bryan show me how to add a timer to the script as I wanted a short delay from when the event is triggered by the user to when the blade would start to fall.

The cake was created with an asset of a single slice of cake that I got for free on the Unity store. I combined 3 slices to make a half and then made 2 halves as 2 different parent objects then they are frozen on all constraints. I made a collisions script that when the extra box collider that I placed on the blade hit the 2 halves it would turn off the constraints as well as add a bit of force on the halves.  I was also reminded that I need to have meshes on each of the child slices and not just 1 for each of the parent objects to get a collision script to work properly!

The original version of the lever was one of the trickiest parts of the whole project. The lever is made up of 2 parts, the handle/stick, and the pivot point. It took a lot of experimenting to get the lever to not just spin around the pivot 360, and once again with Bryan's help, we created a script that would allow the user to interact with the lever on a GetKey and only move a small amount around the pivot.
This script ends up being obsolete in the final VR build but still works nicely for presentation's sake. I also use the GetKey "space" from this script to tie to any of the other user-triggered events, like the fallingblade script which was trigger on GetKeyUp "space" to give the illusion that the lever itself was causing the all the events in the scene to unfold before the user.

I also added 2 sounds in the scene, the first was a text-to-speech voice saying "let them eat cake" that was tied to the RotateKey script. This sound effect is later added to the final falling blade script. The other is a chopping sound that I attached to a tiny box collider that the blade box collider triggers when it hits.

With the addition of steam VR to scene the way, the lever interaction had to be updated as to be useable by a VR player. Of course, I turn to Bryan for help! We tried many ways to make the lever interactable but unfortunately, these components, such as throwable, would contort the pivot which then made the lever fall from left to right instead of the forward and backward motion that I wanted. In the end, the only extra component that was added was added was a mesh collider that just makes the lever object pushable and then a script was added to trigger the falling when the lever rotated past a point.

No comments:

Post a Comment