Defeat the Ever Popular Bunny

Matt Braun
CPE 471
Spring 2004
Professor Wood

Introduction

The final project utilizes the entire combination of tools we have learned from 471. To illustrate the tools, I have a basic character that can fire a bullet from different stances and angles. Using collision detection, the bunny will move along the ground when struck by the bullet.


Figure 1: Initial view of program


Appearance

To give the character and the ever-popular bunny the appearance of standing on ground, I texture mapped a plane for them to stand one. I loaded earth.bmp for the plane, given to us by Professor Wood. I loaded the bunny mesh (bunny500.m) into the scene for the character to interact with. The bunny is viewable in wire frame mode, filled in with silhouette edges, or lighted with silhouette edges. The bunny can be rotated on its own using regular transformations. The bunny can also be translate and scaled.The character is built using hierarchical modeling. The character consists of quadric objects: cylinders and spheres. I took a picture of a face and blended the hair out using Photoshop and then texture mapped it onto the head to give it a face. I made a quick picture in Photoshop to have some words on a shirt and then texture mapped it around the torso of the character. To make the character move appendages smoothly, I added spheres as joints.

Functionality

The character is designed to shoot the bunny. At the end of his left arm (the right side), he has a bullet always loaded. The bullet will fire in the direction his forearm is pointed. Once fired, the program checks to see whether or not the bunny was hit using collision detection. To implement collision detection, I created a tight box around the bunny calculated using the maximum and minimum values from the bunny when the mesh is loaded. If the bullet enters the bounding box around the bunny, the bunny is struck and translated backwards across the ground. To figure out the change in bullet location, I used sin and cosine to figure out the bullets travel.


Figure 2: He MISSES!


The user can rotate any appendage of the character. The user can do things such as rotate the head or make his foot swivel. Since he is hierarchically modeled, you will notice that when you adjust parts such as the right bicep, his right forearm will move along with it.


Figure 3: He Kicks and Fires!


You can rotate and translate the camera to get a better view of the character and the bunny. This makes it really easy to see how the bullet travels and when it strikes the bunny. When rotating the camera, the silhouette edges on the bunny are updated to reflect the rotation. However, this computation of silhouette edges does tend to slow down the program. The camera movement is restricted to not go below the ground when in perspective mode. Orthographic mode is left in the program in case the user wants to view that mode but my program is far better viewed in perspective. In perspective mode, you are able to see the ball travel closer or farther away to the viewer. You can rotate the camera and put the bunny in wire frame, then shoot the bullet into the bunny and see the bullet encapsulated in the bunny.


Figure 4: Camera Translated and Rotated


Even more amazing, he can perform the splits with graceful ease. When performing the splits, you can stop him in the middle of his splits. As odd as it is, this is useful in hitting the bunny. Now that he is lowered, he can shoot straight out and hit the bunny. On top of the splits, you can move him to the left and to the right and then shoot the bunny. And even more, you can have him kick his left leg (right side) out. This was implemented due to aspirations of having him kick the bunny out of the scene but time constraints prohibited that happening. The kick can also be paused and restarted.


Figure 5: Doing the Splits


User's Guide

From the keyboard:

  1. 'a' Turn on/off animation and make him do a little dance.
  2. 'e' Cycle through wire frame mode and filled mode for bunny
  3. 'f' Fire the bullet
  4. 'k' Stretching out (Kick right side leg outwards)
  5. 'l' Enable/Disable Lighting on the bunny
  6. 'q' Quit the Program
  7. 's' Do the SPLITS! Can be started and stopped with another press
  8. 'x' Move him to the left
  9. 'v' Switch between Orthographic and Perspective mode (Perspective Recommended)
  10. 'z' Move him to the right

From the menu's:

The main menu has three submenu's and the option to quit. In the first submenu, "Move body parts", you can rotate any body part a predefined amount. In the submenu, you can choose which part to use. To move the body part, simply click the left mouse button to move the part one way and the right mouse button to move the other way. The movements depends on the body part.

From the second submenu, "Camera Transformations," you can either rotate the camera or translate the camera. Click and move the mouse to perform the transformation.

From the third submenu, "Transformations," you can rotate, scale, or translate the bunny. If you scale or translate the bunny, the collision of the bullet and bunny will be thrown off. Click and move the mouse to perform the transformation.

Matt Braun