Tracking-related functions & macros

CAVEGetPosition (CAVEID id, float pos[3])
Returns the current position of the head, the wand, or an eye. id indicates which position to return - it can be CAVE_HEAD, CAVE_WAND, CAVE_LEFT_EYE, or CAVE_RIGHT_EYE.

CAVEGetOrientation (CAVEID id, float ori[3])
Returns the current orientation of the head or the wand, in Euler angles. id indicates which position to return - CAVE_HEAD or CAVE_WAND. ori consists of the rotation about X, about Y, and about Z; the angles are in degrees.

CAVEGetVector (CAVEID id, float vec[3])
Returns a unit-length vector for the head or wand, pointing in a given direction, based on the current orientation. id indicates which vector to return; it can be CAVE_HEAD_FRONT, CAVE_HEAD_BACK, CAVE_HEAD_LEFT, CAVE_HEAD_RIGHT, CAVE_HEAD_UP, CAVE_HEAD_DOWN, CAVE_WAND_FRONT, ... .

CAVEBUTTON1, CAVEBUTTON2, CAVEBUTTON3
Macros for the current state of the wand buttons. The value is 0 when the button is released, non-zero when it is pressed.

CAVEButtonChange(int button)
Returns 1 if the button has been pressed since it was last checked, -1 if it has been released, 0 if there has been no change. button is the button number (1,2, or 3).

CAVE_JOYSTICK_X, CAVE_JOYSTICK_Y
Macros for the current state of the wand joystick. The values are floats, normally in the range -1.0 to 1.0. When the joystick is not being pushed, the X and Y will be close to, but not exactly, 0.


CAVE tracking actually supports up to 8 sensors, and up to 16 buttons and 16 valuators.

To get data from sensors other than the first two, use the macro CAVESENSOR(sensornum), and the functions CAVEGetSensorPosition(), CAVEGetSensorOrientation(), and CAVEGetSensorVector(). The number of tracked sensors is CAVEptr->num_sensors.

To read the state of other buttons or valuators, use the CAVEController struct. The struct entries are num_buttons, num_valuators, button[], and valuator[] (e.g. CAVEController->valuator[2]).


interact.c - Example of interaction, using tracker & wand data


Previous page    Next page

Last modified 15 June 1996.

Dave Pape, pape@evl.uic.edu