Wednesday, November 27, 2019

Final Project Update 2

This week I set the scene up in Unity, adding my trash objects as prefabs so when I created the script to make spawners they would be able to have all attributes of the original, like size and scripts, but the spawners can randomly instantiate between the 8 prefabs.
This ended up being the longest code that I've made! Just because I had to create a line for each of the 8 cases.

Brian also helped me with the code that creates a sine wave motion in the objects as well as places a random force. This helps to make the scene look more like it is underwater, with the objects bobbing up and down and around the scene. I did decide not to add this script to the net object, as visually I liked the idea that it was too heavy to push or pull.

I also placed Box Colliders on all of the trash objects, except the net because there was too much of an issue of the objects clipping into the floor. Although I may take this off of both of the six-packs models as I think that it gives them too much of a stiff feeling. I used box colliders so as the scene fills up with trash it wouldn't be as intensive on the system as using mesh colliders.

I decided at the very last minute to create some coral in Tinkercad! I just thought the scene needed a bit more set dressing, but I did not want to add too much as I still want the focus to be the accumulation of the garbage over time.

This week I also did a lot of research on creating gestures in Kinect/Unity. This seems a little beyond me right now, but if I do still implement the circular hand motion I think I will try to plot it in code with a 4 pointed diamond shape. Of course, this is way harder (to me) than just saying it! My other choice would be to use Machine Learning, which would be teaching a program the circular motion, and their variations, over time. It would then be able to give me the information I would need to code it to the Unity script. The backup plan is to use the wave motion that is already scripted into Unity by the Kinect with MS-SDK by RF Solutions.
A quick video of what I have so far!


Wednesday, November 20, 2019

Final Project Update 1

Thanks to Brian I was able to obtain an Xbox Kinect v1! I also installed the SDK on my laptop computer as well as there is an asset in the Unity store that enables connection from the Kinect into Unity fairly easily. I need to look more into creating custom gestures as the one that comes in the asset does not have the wax on/was off hand motion already.

I also decided to do this project in 3D. The reason is simple, I really enjoy making in Tinkercad. That is where I spent most of my time this week, making 3D trash. The only object I still want to make is a fishing net, but I am having a hard time making something that doesn't just look like a weird flat object. Otherwise I have created a bottle, a cut and uncut 6 pack holder, a newer and more ripped apart plastic bag and 2 coffee cups.
One thing I realized while creating these is that I will have to look into is if it is possible to make items translucent in Unity, to give the plastic items a realistic feel.

Wednesday, November 13, 2019

Final Project Proposal

1) Concept: I want to create an interactive screen-based project using the Xbox Kinect. Much of my current practice is based around the Anthropocene as well as the ability to advocate viewers/users into action or learning more about an issue. For this project, I want to create a plane of water (I'm not yet sure whether it should be in 2D or 3D) that over time becomes filled with garbage and other discolored liquids. The user will be able to clean the area (using the Kinect sensor) by doing the 'Wax on, Wax off' hand motions. I feel this movement is both recognizable as made famous by the Karate Kid movie, but as in the movie is also an act of everyday cleaning that is familiar to most people in the home setting. This project will take the act of cleaning for the common person out of the home as well as actively cleaning an outdoor environment.

2) Assets: I will need a Kinect sensor - hopefully, I will be able to borrow this from someone I know.
                 After deciding if I am going to be using 3D or 2D Unity - I will create the visual assets accordingly. (ie the environment, the trash, etc) either in Tinkercad or Photoshop.

Research: Kinect to Unity Programing
                      -2D programming if this is the route I decide to go.
                  Fluid physics and interactions
                  In Unity getting items to instantiate random objects in different areas of a plane
              
Schedule:  Week 1:
                    -Decide if I'm working in 2D or 3D
                    -Start designing assets accordingly
                    -Obtain a Kinect sensor
                    -Start research on Kinect and Unity programming

                  Week 2:
                  -con't of week 1
                  -start to bring assets into unity and creating materials for color
                  -figure out what can and cannot be done without scripts
                 -start researching scripts needed
           
                  Week 3:
                  - con't of week 2
                  - start debugging
                  - tweak any issues as they arise
                  -cry

                   Week 4:
                - con't of week 3

Imagery and Inspiration:



via GIPHY

 ocean plastic

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.