Copied code from OpenVR-Tracking-Example but tweaked to build with Visual Studio.
- +y is up
- +x is to the right
- -z is forward, -z is in front of you and +z is behind you
- distance unit is meter
NOTE: The orientation depends on the role assigned to the trakcer device. Please, see this page.
You were right, the orientation depends on the assigned roles. I checked the orientations of different roles. All roles, except the "hold in hand" role have the same orientation. Furthermore, the "hold in hand" role seems to switch its orientation from time to time...
And see also this issue opened in openvr repository. It says that the role setting "HELD IN HAND : ANY HAND" and "DISABLED" have a diffrent orientation.
How to get the serial number to identify all the given vive trackers:
char serialNumber[1024];
vr::VRSystem()->GetStringTrackedDeviceProperty(deviceID, vr::Prop_SerialNumber_String, serialNumber, sizeof(serialNumber));
printf("Serial Number = %s \n", serialNumber);
would output like this:
Serial Number = LHR-0DC0F4XX
SteamVR Announcement: Recent Vive Tracker Changes
Date: 2018.10.11.
SteamVR Input added the ability to configure a tracker as "held in hand", which makes the tracker act as a controller. It also added default bindings for those controllers that work in many games in category 3 (and the ability to rebind inputs for many more games.)
See the entire announcement on here.
Whenver a device is connected (aka. turnning on its power), VREvent_TrackedDeviceActivated
event is set. You can retrieve device ID with VREvent_t::TrackedDeviceIndex_t
.
TrackingUniverseStanding assumes 0,0,0 to be on the floor in the center of the Play Area set during Room Setup.
TrackingUniverseSeated assumes 0,0,0 to be the player's head. The seated universe center is set and saved by calling ResetSeatedZeroPose through the OpenVR API (many older seated games already do this on start or on key press) or within the Dashboard options menu (press the system button and click on the gear icon). The Dashboard options means that devs no longer need to implement a calibration screen in each game and because the seated center is saved across session it isn't necessary to set at the start.
I'd strongly encourage seated games to use the seated universe rather than standing universe.
The original post can be found on here