I’m using the MRTK toolkit with the oculus XR plugin to have some extra assets.
I have a small pop up menu that’s supposed to show when the player faces their palm to the camera for a certain amount of time, and disappear when facing away from the camera.
This works, however, if the application is paused and resumed for whatever reason by system means (on the device I’m using, the Oculus Quest 2, this is done by pressing the index and thumb fingers while facing the camera) the angle calculations stop working, they are stuck very close to the same number (the one that it last calculated before pausing), regardless of my hand orientation.
My hands however, miraculously render just fine, and rotate and follow my hand just fine.
What could be wrong? Here’s the code I’m using.
Declaration + Start:
IMixedRealityHand handRight;
float angle = 180;
Update function:
//handtracking angle calculation
if (handRight == null)
{
handRight = HandJointUtils.FindHand(Microsoft.MixedReality.Toolkit.Utilities.Handedness.Right);
Debug.Log("Finding hand...");
}
else if (handRight.Enabled)
{
handRight.TryGetJoint(Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint.Palm, out var pose);
angle = Mathf.Abs(Vector3.Angle(pose.Up, Camera.main.transform.forward));
}
else
{
angle = 180;
}
Additionally, just have a small debugUI where I print the angle to keep track of it.