CAVElib - Tracking & Controls

Tracking is for:
  • viewer-centered perspective
  • 3D, physical interaction


Tracking data:
  • Head position (X/Y/Z)
  • Head orientation (Xrot, Yrot, Zrot)
  • Wand position (X/Y/Z)
  • Wand orientation (Xrot, Yrot, Zrot)


Controller data:
  • 3 buttons
  • Joystick (X/Y)

Tracking-related functions & macros

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

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

CAVEGetVector (CAVEID id, float vec[3])
Returns unit-length vector for head or wand, pointing in a given direction, based on current orientation. id indicates which vector to return; 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 current state of wand buttons. Value is 0 while button is released, non-zero while pressed.

int CAVEButtonChange (int buttonNum)
Returns change in state of a button, since the last time it was checked. buttonNum is 1, 2, or 3. Return value is 1 for button-pressed, -1 for button-released, 0 for no change.

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


Example: interact.cpp




next