Please no unity answers.
The following code is failing for my app until I let the controller go to sleep and then resume while running. Not sure if this is a bug in the SDK or... ??
if(auto pose = state->TryGetPointerPose(currentCoordinateSystem))
{
if(source->IsPointingSupported)
{
if(auto controllerPose = pose->TryGetInteractionSourcePose(source)) //FAILS
{
controllerRay = { convFloat3(controllerPose->Position), convFloat3(controllerPose->ForwardDirection) };
auto uwpQuat = controllerPose->Orientation;
quat q(uwpQuat.x, uwpQuat.y, uwpQuat.z, uwpQuat.w);
mat4 orientation4;
q.toMatrix(orientation4.m);
currentInputState.inputDevices[evState.deviceIndex].position = controllerRay.o;
currentInputState.inputDevices[evState.deviceIndex].forwardVector = controllerRay.d;
currentInputState.inputDevices[evState.deviceIndex].upVector = convFloat3(controllerPose->UpDirection);
static mat4 poses[8];
currentInputState.inputDevices[evState.deviceIndex].pose = &poses[evState.deviceIndex];
poses[evState.deviceIndex] = orientation4;
currentInputState.inputDevices[evState.deviceIndex].side = (evState.deviceIndex == 0) ? InputState::InputDevice::DS_RIGHT
: InputState::InputDevice::DS_LEFT;
evState.orientation = mat4GetMatrix3(orientation4);
}
}
else
{
controllerRay = { convFloat3(pose->Head->Position), convFloat3(pose->Head->ForwardDirection) };
}
}