WVR_GetPoseState¶
- WVR_EXPORT void WVR_GetPoseState(WVR_DeviceType type, WVR_PoseOriginModel originModel, uint32_t predictedMilliSec, WVR_PoseState_t * poseState)
Function to get VR device pose w/wo prediction.
The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the future. Pass 0 to get the state at the instant the method is called. Most of the time the application should calculate the time until the photons will be emitted from the display and pass that time into the method.
For devices where isValidPose is true the application can use the pose to position the device in question.
Seated experiences should call this method with WVR_PoseOriginModel_OriginOnHead and receive poses relative to the seated zero pose. Standing experiences should call this method with WVR_PoseOriginModel_OriginOnGround and receive poses relative to the Arena Play Area. TrackingUniverseRawAndUncalibrated should probably not be used unless the application is the Arena calibration tool itself, but will provide poses relative to the hardware-specific coordinate system in the driver.
- Parameters
- type -
Type of the device to get the InputDeviceState. (refer to WVR_DeviceType)
- originModel -
Tracking universe that returned poses should be relative to. (refer to WVR_PoseOriginModel)
- predictedMilliSec -
Number of milliseconds from now to predict poses for. Positive numbers are in the future. Pass 0 to get the state at the instant the function is called.
- poseState -
to obtain pose data (refer to WVR_PoseState) of tracked device by WVR_DeviceType.
- type -
How to use¶
Here is an example for the function:
#include <wvr/wvr_device.h>
uint32_t id = 1; // 1: HMD, 2: Controller_Right, 3: Controller_Left
uint32_t ieOrigin = 0; // 0: On Head, 1: On Ground
float ipredict_sec = 0.0f;
WVR_PoseState_t poseState;
// initialize
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
poseState.poseMatrix.m[i][j] = 0.0f;
}
if (i < 3) {
poseState.velocity.v[i] = 0.0f;
poseState.angularVelocity.v[i] = 0.0f;
}
}
poseState.isValidPose = false;
poseState.is6DoFPose = false;
WVR_GetPoseState(static_cast<WVR_DeviceType>(id), static_cast<WVR_PoseOriginModel>(ieOrigin), ipredict_sec, &poseState);
Invoking WVR_GetSyncPose or WVR_GetPoseState multiple times with different predicted time is allowed in programming before calling WVR_SubmitFrame, and in this case, passing the final rendered pose as the third parameter of WVR_SubmitFrame is necessary. Please note that never call these two pose-fetching APIs more than once before calling WVR_SubmitFrame without the pose passed as a parameter.