Wednesday, December 4, 2019

Final Update 3

My last additions to this project have been to grab a fish asset from the Asset store as I wanted something with a bit of animation to it moving around the scene. I also wanted to have the fish
get stuck to the nets as they appeared. With Bryan's help, both of those things were done in one script
I also added the net script to the items of trash that have box colliders but without the part of the script that reinstates the added forces/movement as I like the look of garbage piling on the ocean floor.  
Also from Bryan's suggestion, I added the anti-crash code that can be found on the class website to deal with the possibility of a crash since I am instantiating so many objects over time.
Unfortunately, I was not able to get the Kinect to work within my scene, but this is something I would like to still work on in the future. Overall even though I was not able to have the motion controls I am happy with the look of the world that I was able to build in Unity.


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.

Wednesday, October 16, 2019

Milestone 1 - Where I am at currently

 For our first milestone project, I am creating a guillotine. It is a deceptively simple machine. I first created the main assets of the guillotine and lever in tinkercad.


When I imported the assets into Unity I originally used a mesh collider for all the parts. This did not work very well for the guillotine. As the main body is one piece it created a strange angular shape that would not allow for anything to rest on the plank of the guillotine. It was better to just create rough shapes with multiple box colliders. As for the guillotine blade and lever, the mesh colliders work nicely.
 Things I want to work on this week is:
-Animating both the falling of the blade and lever.
-Create scripts to allow the user to pull the lever and then trigger the falling of the blade.
-Work on the actual blade slicing.
-Create a small environment as a setting so it's not just a plane floating in space.

Wednesday, October 2, 2019

Rube Goldberg Event...now with scripts!

For this version of the Rube Goldberg event, I imported 2 objects from the unity store: Donuts and plate03. I gave them both mesh colliders and I wanted to use them as stand-ins for the original pink cube and end green cube. The Donuts asset seemed to have a bounce physics already added to the prefab that I was not able to find in the inspecter to change, so I just had to readjust where the original end point was located to compensate.
With the new assets, I wanted to script end the whole event with a particle sparkle when the Donuts collided with the plate03. Unfortunately, I was never able to get to work. I looked up online many ways to fix the issue but was none seemed to trigger the particle effect on collision. You can view my code below.



I then decided to just add a color change effect when the Sphere collides with the dominoPlatform turning it to white. Here I had another issue that the color would not visibly change in the play window but when viewing the video you can see on the right-hand side in the inspector that the color does change to white on collision. I'm not sure what was going wrong there, I even tried taking off the material shader of brown just in case that was overriding the color change, but it would still stay the original color. Code for that below.





The script that did work for me was that at the beginning of the event I added a user input where on pressing of the spacebar would raise my newly created pink wall. Instead of the Sphere falling in from the sky this wall is now blocking the Sphere from starting the event until the user decided to. This wall is frozen on the X & Z axises and in the script, I added a public yPush so that I would be able to change the force of the keystroke while in Unity.


I would like to work more on how to understand what script conponats are available and understanding how they work in a more intuatave way than just googling any issue. Most examples online are able game creation and player modle interaction which I did not find very helpful.