diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Rigs/XR_EXT_hand_tracking.cs b/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Rigs/XR_EXT_hand_tracking.cs index a563e59bd..a60bc21e2 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Rigs/XR_EXT_hand_tracking.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Rigs/XR_EXT_hand_tracking.cs @@ -9,14 +9,13 @@ namespace UniVRM10 /// * https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#_conventions_of_hand_joints /// * https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0/tpose.ja.md /// + /// OpenXR は右手系なのに対して Unityは左手系です。 + /// この Rig が期待するボーンの値は、XR_EXT_hand_tracking の Joint の値を Z軸反転で座標変換したものです。 /// public static class XR_EXT_hand_tracking { /// /// up vector と forward vector の外積により空間を算出して、回転を得ます。 - /// - /// OpenXR は右手系なのに対して Unityは左手系です。 - /// 結果として、X軸が反転することに注意してください。 /// /// /// @@ -34,12 +33,12 @@ namespace UniVRM10 /// /// 親指は XZ 平面45度です。 /// - public static Quaternion LeftThumb = GetRotation((Vector3.forward + Vector3.left).normalized, (Vector3.right + Vector3.forward).normalized); + public static Quaternion LeftThumb = GetRotation((Vector3.forward + Vector3.right).normalized, (Vector3.left + Vector3.forward).normalized); /// /// 親指は XZ 平面45度です。 /// - public static Quaternion RightThumb = GetRotation((Vector3.forward + Vector3.right).normalized, (Vector3.left + Vector3.forward).normalized); + public static Quaternion RightThumb = GetRotation((Vector3.forward + Vector3.left).normalized, (Vector3.right + Vector3.forward).normalized); /// /// VRM-1.0 の T-Pose の定義から各指はX軸と並行です。親指はXZ平面に45度です。 diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Vrm10ControlBone.cs b/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Vrm10ControlBone.cs index f2471e9d4..3a697bf35 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Vrm10ControlBone.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/Vrm10ControlBone.cs @@ -92,8 +92,7 @@ namespace UniVRM10 { get { - var delta = Quaternion.Inverse(_initialControlBoneGlobalRotation) * ControlBone.localRotation * _initialControlBoneGlobalRotation; - return InitialControlBoneLocalRotation * delta; + return _initialControlBoneGlobalRotation * Quaternion.Inverse(InitialControlBoneLocalRotation) * ControlBone.localRotation * Quaternion.Inverse(_initialControlBoneGlobalRotation); } }