Ejemplo n.º 1
0
void FreeVRTracker::update() {
  // FreeVR Wand is sensor 1
  #define WAND_SENSOR     1

  vrPoint wand_location;
  vrPointGetRWFrom6sensor(&wand_location, WAND_SENSOR);
  pos[0] = wand_location.v[0];
  pos[1] = wand_location.v[1];
  pos[2] = wand_location.v[2];

  /* get Euler angles for wand orientation */
  vrEuler wand_orientation;
  vrEulerGetRWFrom6sensor(&wand_orientation, WAND_SENSOR);

  orient->identity();
  orient->rot(wand_orientation.r[0],'x');
  orient->rot(wand_orientation.r[1],'y');
  orient->rot(wand_orientation.r[2],'z');
  orient->rot(90,'y'); // to face forward (-z)
}
Ejemplo n.º 2
0
void vrlib_wand_orient (float wand_orient[], int virt_world)
{
/* TODO: The user of Eulers is seriously depricated.                          */
/*       This section should be rewritten.                                    */
    vrEuler     euler;

    if (virt_world)
    {
        vrEulerGetVWFromUser6sensor (&euler, 0, WAND_SENSOR);
        wand_orient[VR_AZIM] = euler.r[VR_AZIM];
        wand_orient[VR_ELEV] = euler.r[VR_ELEV];
        wand_orient[VR_ROLL] = euler.r[VR_ROLL];
    }
    else
    {
        vrEulerGetRWFrom6sensor (&euler, WAND_SENSOR);
        wand_orient[VR_AZIM] = euler.r[VR_AZIM];
        wand_orient[VR_ELEV] = euler.r[VR_ELEV];
        wand_orient[VR_ROLL] = euler.r[VR_ROLL];
    }
    return;
}