Simple problem and it is not working: Get the pose of the left and right hand controller. According to spec you should create an action like this:
XrActionCreateInfo createInfo{XR_TYPE_ACTION_CREATE_INFO};
strcpy(createInfo.actionName, name);
strcpy(createInfo.localizedActionName, localizedName);
createInfo.actionType = XR_ACTION_TYPE_POSE_INPUT;
const XrPath subactionPaths[ 2 ] = {path("/user/hand/left"), path("/user/hand/right"};
createInfo.subactionPaths = subactionPaths;
createInfo.countSubactionPaths = 2;
xrCreateAction(actionSet, &createInfo, &action);
Which allows filtering for left and right hand. Then I suggest this action for “/user/hand/left/input/aim/pose” and “/user/hand/right/input/aim/pose”.
Now according to spec I need an action space like this (one for each hand):
XrActionSpaceCreateInfo createInfo{XR_TYPE_ACTION_SPACE_CREATE_INFO};
createInfo.action = action;
createInfo.subactionPath = path("/user/hand/left"); // respectively path("/user/hand/right" for the other hand
createInfo.poseInActionSpace.orientation.w = 1.0f;
xrCreateActionSpace(session, &createInfo, &actionSpaceLeft)); // respectively actionSpaceRight
So far so good. Then I should use locate space to get the poses:
XrSpaceVelocity velocity{XR_TYPE_SPACE_VELOCITY};
XrSpaceLocation location{XR_TYPE_SPACE_LOCATION};
location.pose.orientation.w = 1.0f;
location.next = &velocity;
if(XR_SUCCEEDED(xrLocateSpace(actionSpaceLeft, stageSpace, predictedDisplayTime, &location))){
// store left position...
}
if(XR_SUCCEEDED(xrLocateSpace(actionSpaceRight, stageSpace, predictedDisplayTime, &location))){
// store left position...
}
Now my problem is this. I start out with no controller attached. I attach the right controller. I get the pose for the right controller. Now I attach the left controller. I get now the pose of the left controller for both controllers with the right controller being totally ignored. This also happens if I start with both attached or attaching them the other way round. It looks as if the filtering is ignored and the first one (left hand controller) always picked.
Do I understand something wrong on the spec or is it not possible with OpenXR to get the pose of the hand controllers independently without using different actions? If so how are you then supposed to deal with an undefined number of trackers which have undefined (according to spec) unique path names?