Made hand menu example more durable when using weird joint orientations.
@@ -224,9 +224,13 @@ namespace StereoKitTest
// Position the menu relative to the side of the hand
Hand hand = Input.Hand(handed);
+ Vec3 at = hand[FingerId.Little, JointId.KnuckleMajor].position;
+ Vec3 down = hand[FingerId.Little, JointId.Root ].position;
+ Vec3 across = hand[FingerId.Index, JointId.KnuckleMajor].position;
+
Pose menuPose = new Pose(
- hand[FingerId.Little, JointId.KnuckleMajor].position,
- hand[FingerId.Little, JointId.Root].orientation * Quat.FromAngles(-90,0,0));
+ at,
+ Quat.LookAt(at, across, at-down) * Quat.FromAngles(0, handed == Handed.Left ? 90 : -90, 0));
menuPose.position += menuPose.Right * offset * U.cm;
menuPose.position += menuPose.Up * (size.y/2) * U.cm;
