Fight your way through a hord of ferocious hopping bunnies. A player shoots at the bunnies, and if a bunny is hit, it dies. All ten bunnies must be killed to win the game.
In order to determine whether a bunny was shot or not, I used raycasting. I shot a ray from the center of the window to a bounding sphere around every bunny. If the projection of the center of the bounding sphere on the ray was less than the radius of the sphere, a bunny was shot.
When the player clicks the left mouse button, a ray is shot and the gun fires.
The camera and bunnies both check for collisions with the edges of the map and with every tree on the map. This ensures that no object can run through another object.
The movements of the bunnies follow the rules of boids. They have continuously updated velocities that are determined by the position of the bunny relative to the center of mass of the bunnies, the circular path that they follow, and relative positions to other bunnies. If a bunny gets close to the camera, it's velocity is reversed as it attempts to run away from the shooter.
The camera is controlled with the mouse: pushing the mouse forward looks down, pulling looks down, and left and right move the camera left and right respectively.
The gun is attached to the camera and is rotated according to where the camera is looking.
The w, a, s, and d keys are used to navigate the character in the world.
I used the tiny_obj_loader to load meshes
Reference used to determine how boids should move: Boids Reference
Information used to cast a ray to determine if a bunny was shot: Raycasting
Extract the files and run make.
Only supported on Linux.