# Interactable 3D Model/Mesh & Cannon

CSS451 3-D Computer Graphics course introduces practical and popular three-dimensional (3-D) graphic algorithms. Examines modeling (how to build 3-D objects), animation (how to describe the motion of objects), and rendering (how to generate images of 3-D objects in animation). In this course, I collaborated with 1 classmate to build a mesh and cylinder model that can be modified to have a varying number of vertices, a transformable texture, and direct vertex translation capabilities. In addition, my teammate and I built an interactable cannon that is fully transform-interactive that can shoot a ball into a hoop, incrementing the player's score. Both projects were done in Unity 3D, using C#.

Interactable Cannon

### The interactable cannon is made of 3 parent-child nodes that are each selectively transformable. The grandparent node, the base, can be translated to move the whole cannon around, and rotate. The parent node, the arm, can be scaled vertically to increase the height of the cannon reach. And the child node, the barrel, can be rotated on the cannon's hinge pivot to change the verticle angle the ball is fired at. What is interesting about this cannon is that each piece of the cannon is actually at the center of the world, and their meshes are actually relocated using TRS matrix algebra to be positioned in their appropriate locations. In addition, the hoop is can be moved with direct interaction from the user's mouse, and the ball's texture can be swapped at any time.

Textured Mesh Model

### The mesh model has a texture that can be translated, scaled, and rotated on the mesh. It has a set of n by n vertices that can be translated with direct interaction from the user's mouse. The mesh is calculated by a series of triangles made from these vertices, with these triangles, I can calculate the triangles' and vertices' normals and display them with the white bars that appear when the user presses the "CTRL" key. I implemented the algorithm that calculates the number of triangles, which triangles are owned by which vertices, and how the normals appropriately change after translation, abstracting it to fit any number of n by n vertex resolution from 2 by 2 resolution to 20 by 20 resolution.

3D Cylinder Model