Kart Racer

by Noah Harper

CPE 471 Final Project - Fall 2014 (Sueda Sensei)



Kart Racer in action.



Goals

To practice hierarchical modelling.
To become more accustomed to making camera controls.
To gain experience working with textures.
To learn how to implement basic collision detection.

Features

1. Third person camera. To make the third person camera, I started with the code from assignment 4, which had a first person style camera. From there I disabled pitch and replaced the constant forward and back controls with acceleration and deceleration controls, and used those to determine forward and back translations. I rendered my vehicle at the previous camera position, and translated the camera back from that position to simulate a third person perspective.

2. Spinning wheels, turning wheels, and sliding. I made it so that the wheels spin while the vehicle is moving with the amount of spin based on the velocity. In addition, I made it so that the wheels would rotate in the direction that the vehicle is currently turning. I also made it so that the vehicle itself would slightly rotate and translate when turning at a high velocity to simulate a sliding motion. These were all easily accomplished by using hierarchical modelling to build my vehicle, which allowed me to rotate the wheels separate from the body.

3. Collision detection. I implemented a simple box-on-box collision detection system. To represent the vehicle I used 2 boxes that rotate separate from the vehicle to maintain alignment with the X and Z axes.

4. Textures and shading. I adding basic textures to my world and used blinn-phong shading with the texture color vector used in place of the diffuse vector and I averaged the texture color with the ambient vector to achievement a very dark texture on non-lit surfaces (hard to see in the provided images).

Controls

"a" to turn left
"d" to turn right
"." to accelerate
"/" to brake/reverse

Screenshots



The slide animation.





A look at the shading.





Collision on a wall.





Collision on a tree.



Resources

Examples and files provided with the course: tinyobjloader, Image.cpp, Shape.cpp, as well as some camera code and texture code
All textures and one model free from TurboSquid.com
Tree model free from TF3DM.com