CS 497 Project
Paul Rajlich
Final Report:
Originally, I sought to implement navigation in a larger-than-CAVE
world using Inventor. This took a while, but once I got past
some initial frustrations, I implemented several other features
and had a lot of fun with this project.
Features Implemented:
- Navigation using wand and joystick
- "Automatic" climbing and falling by detecting "virtual floor"
- collision detection (with walls)
- bazooka - fire projectiles
- monsters - move randomly
- collision detection with projectiles - can kill monsters
Navigation
For navigation, I chose to use a combination of the wand
and joystick. When the wand is pointing to one side greater
than some threshold angle, the user starts to rotate to that
side at a speed proportional to the angle. For example, to rotate
fastest, you would point the wand parallel to the screen. Then
the player moves forward and backward proportional to the
joystickY value.
Originally, all navigation was done with the joystick. I showed
a demo to a couple of friends and they had problems with the
navigation (the joystick is rather stiff). The new navigation
was inspired by "Cathedral", although it is somewhat different.
As in the description, I added the navigation transforms to the
SceneGraph rather than using CAVENavTransform(). This way,
the transformations can be applied to a subgraph rather than
the entire scene graph. Specifically, the gun is to be drawn in
CAVE coordinates whereas the scene and monsters are to be drawn
in world coordinates. The user has a position and orientation in
the world. So, what is done is that the user is translated to
the appropriate position and then rotated to get the correct view.
Climbing and Falling
To implement climbing and falling cheaply, I used OpenInventor's
SoRayPickAction. The method involves shooting a ray down from the
user's head position. If the ray intersects the "virtual floor"
within some threshold of the actual floor, then everything is fine.
If the "virtual floor" is below the actual floor, the user begins
to drop (with acceleration). If the "virtual floor" is above the
actual floor, then the user rises to stand on top of the object
(stair, block, window sill (sp?), monster, etc.).
Collision Detection
For collision detection, I again used SoRayPickAction. This was
done so that the detection was quick and didn't slow down the
game much. However, it can be fooled and the user can end up
stuck in walls, etc.
The idea is based on the fact that the user can only move
forward or backward, rotation doesn't change the position of
the user. So, two rays are shot, one forward and one backward
from the head. The pick action is given a threshold distance
in which to find an intersection. If this happens, then the
user is restored to the position before the last translation.
Combined with the climbing and falling, the idea is that if
something is at head level, then you cannot go through it.
If it is below head level, then you can climb on top of it.
Bazooka
I added the bazooka to provide some interaction between the user
and the virtual world, other than movement. The bazooka is rendered
in CAVE coordinates, but once it fires, it adds the projectile
in world coordinates. This is so that the projectile is
independent of the user's movement. In order to do this, I took
the wand position and used Inventor's SbMatrix operations to
transform that position from CAVE coordinates to world coordinates.
I also did this for the wand orientation.
To determine whether the projectile hits something, a ray is
cast from it in the direction in that it is moving and it is cast
for the distance that the projectile will move in the next step.
If the ray hits something, then the projectile "explodes."
Monsters
The last thing that I did was to add monsters that can be
killed with the bazooka. The monsters are derived from the user,
so they too will be able to have collision detection
and climbing/falling. The monsters move randomly. When the
projectile checks for collisions, it also checks to see if it
has hit anything in a monster's scene graph subtree. If so, then
the monster dies.
Experience Gained:
Gained experience with OpenInventor and the CAVE libraries.
Able to come up with approaches to interaction
that utilized some of Inventor's capabilities.
Acknowledgements
Thanks to both George and Vijay for help with the Inventor
and CAVE libraries.
Paul Rajlich
Last modified: Tue Dec 10 23:45:49 CST