Description
I was given the below assignment from Computer graphics to solve.
How can you help me with this?
In this unit we explored basic concepts of color, color blending, and transparency. For the unit 3 assignment you will demonstrate both your ability to perform transformations on an object and implement principles of color in computer graphics. Beginning with the example program, create a program that will create a 3 dimensional objects. You can use the cube, sphere, or torus knot for this assignment. Your program must display the object within the scene. Your object should be scaled such that it only covers a small portion of the viewing area.
You must animate the object by making it move across the viewing space. When the object reaches the limit of the viewing port it must change direction (think of it as a ball that is bouncing around in a box)
The following example will give you an idea of what this should look like (however your example needs to be a 3D scene with a 3D object and not simply a 2D view.
Bouncing Ball Animation
Each time your object reaches the edge of the viewing area and changes direction, the object should change color. The illusion should be that the ball is bouncing off of a wall and that when it hits the wall it changes color. Your scene should be illuminate with a light in a fixed position such that we can see light and shadow areas on the object and the areas of shadow should change as the ball changes position within the view.
To move your object you should alter the x and y coordinates of the object. Assuming that your mesh were to be called myMesh, the position of the object can be changed by changing the following attributes of the object.
myMesh.position.x
myMesh.position.y
You can experiment to determine the limits of the viewing area on your scene and use this to determine when the object has encountered the edge of the viewing area and to determine the bounce. You can cause the object to move by incrementing or decrementing the value of x and y. When your object encounters the edge of the viewing space you should cause it to ‘bounce’ away in an opposite direction. You can do this by decrementing either the x or y position as appropriate. Experiment with this until you can control the direction of moment of your object and simulate the effect of your object ‘bouncing’ around the area of the viewport.
Make sure that you document your code with liberal comments to ensure that a reviewer understands what you were attempting to do within the assignment.
When you have completed the assignment, you must click on the share button and copy both the “Live and Full Preview” and the “Code View” URL’s and submit with your assignment.