This project is directly (and obviously) inspired by the Sonic the Hedgehog game franchise. It’s set up as an “interactive animation”: Sonic is constantly moving forward along a flat track, and the user can control his motion by using the arrow keys to switch “lanes” and by clicking him to jump. The motivation for this is to make Sonic collect the rings scattered along the track by passing through them, after which they will disappear.
At the end of the track, there is a shuttle loop, and as Sonic approaches it, the camera will auto-switch to an optimal view to watch him roll around it. After the loop, the track will reset, sending Sonic back to the beginning, turning any collected rings back on, and even randomizing their positions.
The main camera is always centered on Sonic, but can be rotated to make it orbit around him to get a different angle. A third camera is also provided, and switching to it lets the user view the track in 2D, exactly like the classic games. Jumping and lane-switch are also implemented in this view, although since the camera is set up to be orthographic, it’s hard to tell which lane Sonic or the rings are in when in this mode.
I created this project as the final for an OpenGL graphics course. Graphics coding was very different from what I was used to because there's a lot of setup which must be done exactly correctly in order to render anything at all. I felt like I had to do a lot of copy/pasting every time before I could write any original code. The most interesting implementation specifics are detailed in my readme: