First-Person Camera Lab
In this lab, you will add a first-person camera interface to a renderer so that the user can move around the scene with the keyboard and mouse.
Camera
Your first challenge is to implement a FirstPersonCamera
class by completing the following steps:
Form a group of no more than three, clone the
first-person-camera
repository, run npm install
, drop in your helper utilities, and run npm run start
.
Define your class in
src/first-person-camera.ts
. Export it.
Add a constructor as described in the reading.
Define methods
reorient
, strafe
, and advance
.
Define methods
yaw
and pitch
.Renderer
Your second challenge is to incorporate your camera into the provided renderer by completing the following steps:
Set up the camera in
initialize
of src/main.ts
.
Handle the WASD and cursor keys.
Add mouse-looking.
Submission
To receive credit for your lab work, follow these steps:
Share a post in the
#lab-gallery
channel on Discord a video of you walking around in your renderer. Tag your group members.
Push your code to GitHub.
Only labs submitted on time will be granted credit. Late labs or forgot-to-submits are not accepted because Wednesday at noon is when your instructor has time to grade.