Assignment 4: Creating a Virtual World
- Due May 13, 2019 by 11:59pm
- Points 10
- Submitting a file upload
Objectives
To create a virtual world using cubes and explore it using a (perspective and orthographic) camera.
Description
Use the features implemented in previous assignments to create a first-person exploration application. A first-person camera (the player) should start in a given position of a 32x32x4 tile-based 3D world (which is made out of textured cubes). The user should be able to navigate in this world using the keyboard and mouse to move and rotate the camera. Your application is required to have the following features:
-
The world is fully created when the application starts.
- Ground is created with a large plane (square).
-
Walls are created with cubes.
- Walls can have different heights in units (1 cube, 2 cubes, 3 cubes and 4 cubes ).
- The faces of the cube should be textured to make it look like a wall.
- The sky is created with a very large cube that is placed at the center of the world and has a texture on each face inside.
- The world layout should be specified using a hardcoded javascript 2D array.
- Each element of the array represents the height of the wall (0, 1, 2, 3 or 4) that will be placed at that location.
-
Camera can be moved using the keyboard.
- W moves camera forward.
- A moves camera to the left.
- S moves camera backwards
- D moves camera to the right.
- Camera can be rotated with the mouse.
- Camera can be zoomed with the mouse wheel.
Resources
- Readings:
- (WebGL) Matsuda/Lea Ch7
- (WebGL) Camera Movement Tutorial: http://learnwebgl.brown37.net/07_cameras/camera_movement.html Links to an external site.
- (HTML/Javascript) How to handle keyboard events: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent Links to an external site.
-
Examples
- Code written in the lab (05/07): https://canvas.ucsc.edu/files/1311688/download?download_frd=1
What to Turn in
1. Canvas Submission
Zip your entire project and submit it to Canvas under the appropriate assignment. Name your zip file "[FirstName]_[LastName]_Assignment_4.zip" (e.g. "Lucas_Ferreira_Assignment_4.zip").
2. Live Hosted Submission
Host your assignment on your UCSC portal. This can be achieved by just putting your entire project directory into the 'public_html' folder which you can access via the UCSC Unix timeshare. Your site link is 'https://people.ucsc.edu/~ucsc_user_name/'.
WHEN SUBMITTING YOUR PROJECT ON CANVAS, PLACE YOUR SITE LINK AS A COMMENT OF THE SUBMISSION.
Read the SubmissionGuide.txt file for further explanation on how to submit your assignment.
Rubric
Criteria | Ratings | Pts | ||
---|---|---|---|---|
Have a ground created with a plain (square shape).
When the application is opened, one should see a ground created with a 32x32 (units) plane.
threshold:
pts
|
|
pts
--
|
||
Have walls created with textured cubes.
When the application is opened, one should see a world with walls with different heights (in units 0, 1, 2, 3 or 4).
threshold:
pts
|
|
pts
--
|
||
Implement camera rotation.
Using the mouse to rotate the view left/right (pan) and up/down (tilt) without moving the camera position.
threshold:
pts
|
|
pts
--
|
||
Implement camera movement.
W - move the camera forward;
A - move the camera to the left;
S - move the camera backwards;
D - move the camera to the right;
threshold:
pts
|
|
pts
--
|
||
Implement camera zooming.
User can zoom the camera in and out with mouse wheel.
threshold:
pts
|
|
pts
--
|
||
Have the ability to switch between an orthographic and perspective projection.
User can change between orthographic and perspective camera using the Z key.
threshold:
pts
|
|
pts
--
|
||
Have a sky box created with a large textured cube.
When the application is opened, one should see a sky in the Horizon.
threshold:
pts
|
|
pts
--
|
||
Total Points:
10
out of 10
|