Joy of Games: Hw#8 – Adding Juice


Adding Juice For this week we were to add a level of polish / juice to a previous assignment. I thought this week it could be fun to give the Mr Trash Wheel simulation assignment another design pass. In office hours Jane mentioned a couple things to look into in addition to prefabs of the different objects. One was how to make a mechanic that actually communicate that its water with objects in it as well as how to convey the “current” controller. Instead of getting deep into fluid dynamic papers Jane mentioned looking into Perlin noise and add force functions to help transfer motion when objects are hit. A lot of water physics and object buoyancy videos tutorial were centered around the law of the Archimedes Principle           



Perlin Nosie & Buoyancy  When searching around for tutorials I eventually landed tutorial playlist to help with floating objects in water using Perlin noise (Ken Perlin was  a guest speaker in Applications class and also teaches at NYU / Future Reality Lab).  There was a small road bump in the actual tutorial code. They used ‘Dimension’ singular as a declared global variable but then referenced it as ‘Dimensions’ plural throughout the rest of the code. (easy to do!) After combing through a couple times I caught the discrepancy and decided to set both to ‘Dimensions’ and to get the first steps working.



Creating the mesh triangulation layer in a script (timecode: 5:16)

Screen Shot 2019-11-17 at 10.30.21 PM.png

My mesh triangulation executed in Unity

Screen Shot 2019-11-17 at 10.11.21 PM.png

However the tutorial code kept breaking after this point, maybe due to a Unity update? Or to an accidental grammar error on my part (will sift back through again later) So went on to try this tutorial out instead

Screen Shot 2019-11-18 at 12.56.41 AM.png

Tutorial: Make a realistic boat in Unity with C#

in this tutorial Erik focuses on the idea of buoyancy. He referenced an article as an inspiration and that “The basic summary of the Gamasutra article is that you have to find out which parts of the boat is below the water. Then you should add a buoyancy force to those parts” . He mentions the fact that everything is built with triangles, and that even our cube gameObject is built out of triangles, 2 on each face. He also then broke down further how each triangle had 3 vertices:

“In Unity you have to deal with at least 2 arrays to control the triangles. One triangle consists of 3 so-called vertices that each has a coordinate in 3d-space like x,y,z. A vertice is a corner in the triangle. One array will store these. The other array will store in which order the vertices form a triangle. When you build a triangle in Unity you have to store the position of the vertices in the array so they form a clockwise loop through all the corners. If you happen to store them counter-clockwise the triangle will be inside out and you will not see it (you will see it if you move to the other side of the triangle).”


Important take aways:

2 arrays:

  1. one to store the x,y,z coordinates
  2. the other stores the order (must be in a clockwise loop or will be insideout)


  • The (cube) consists of triangles. But which are submerged?
    • “We need to find out if one of the triangles is submerged. If the entire triangle is below the water then we can just store it and add buoyancy to the entire triangle. But if only a part of the triangle is below the water, then we have to cut it in pieces and store the pieces that are below the water and add buoyancy to those pieces. It will look like this”





With just the BoatPhysics script on cube



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s