diff --git a/Packages/VRM10/Runtime/Components/LookAt/LookAtEyeDirectionApplicableToBone.cs b/Packages/VRM10/Runtime/Components/LookAt/LookAtEyeDirectionApplicableToBone.cs index dee0ac4ea..511266c23 100644 --- a/Packages/VRM10/Runtime/Components/LookAt/LookAtEyeDirectionApplicableToBone.cs +++ b/Packages/VRM10/Runtime/Components/LookAt/LookAtEyeDirectionApplicableToBone.cs @@ -20,17 +20,17 @@ namespace UniVRM10 private readonly CurveMapper _horizontalInner; private readonly CurveMapper _verticalDown; private readonly CurveMapper _verticalUp; - - public LookAtEyeDirectionApplicableToBone(Transform leftEye, Transform rightEye, + + public LookAtEyeDirectionApplicableToBone(Quaternion root, Transform leftEye, Transform rightEye, CurveMapper horizontalOuter, CurveMapper horizontalInner, CurveMapper verticalDown, CurveMapper verticalUp) { _leftEye = leftEye; - var leftEyeRotation = _leftEye.rotation; + var leftEyeRotation = Quaternion.Inverse(root) * _leftEye.rotation; _leftEyePreMultiplyRotation = _leftEye.localRotation * Quaternion.Inverse(leftEyeRotation); _leftEyePostMultiplyRotation = leftEyeRotation; _rightEye = rightEye; - var rightEyeRotation = _rightEye.rotation; + var rightEyeRotation = Quaternion.Inverse(root) * _rightEye.rotation; _rightEyePreMultiplyRotation = _rightEye.localRotation * Quaternion.Inverse(rightEyeRotation); _rightEyePostMultiplyRotation = rightEyeRotation; @@ -39,7 +39,7 @@ namespace UniVRM10 _verticalDown = verticalDown; _verticalUp = verticalUp; } - + public void Apply(LookAtEyeDirection eyeDirection, Dictionary actualWeights) { SetYawPitchToBones(eyeDirection); diff --git a/Packages/VRM10/Runtime/Components/Vrm10Runtime/Vrm10RuntimeLookAt.cs b/Packages/VRM10/Runtime/Components/Vrm10Runtime/Vrm10RuntimeLookAt.cs index bdd550fc8..9bf9fada4 100644 --- a/Packages/VRM10/Runtime/Components/Vrm10Runtime/Vrm10RuntimeLookAt.cs +++ b/Packages/VRM10/Runtime/Components/Vrm10Runtime/Vrm10RuntimeLookAt.cs @@ -55,7 +55,7 @@ namespace UniVRM10 var rightEyeBone = humanoid.GetBoneTransform(HumanBodyBones.RightEye); if (_lookAt.LookAtType == LookAtType.bone && leftEyeBone != null && rightEyeBone != null) { - EyeDirectionApplicable = new LookAtEyeDirectionApplicableToBone(leftEyeBone, rightEyeBone, _lookAt.HorizontalOuter, _lookAt.HorizontalInner, _lookAt.VerticalDown, _lookAt.VerticalUp); + EyeDirectionApplicable = new LookAtEyeDirectionApplicableToBone(instance.transform.rotation, leftEyeBone, rightEyeBone, _lookAt.HorizontalOuter, _lookAt.HorizontalInner, _lookAt.VerticalDown, _lookAt.VerticalUp); } else {