From 479e64907f0e4ee092fcd87ec52dd8a4d537a297 Mon Sep 17 00:00:00 2001 From: jackfiled Date: Mon, 27 Mar 2023 13:11:01 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=80=9D=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Behaviours/BoneBehaviour.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Assets/Behaviours/BoneBehaviour.cs b/Assets/Behaviours/BoneBehaviour.cs index 5d5dbcd..d86b700 100644 --- a/Assets/Behaviours/BoneBehaviour.cs +++ b/Assets/Behaviours/BoneBehaviour.cs @@ -65,17 +65,12 @@ private void HipUpdate() private void RShoulderUpdate() { + var direction = _transforms[PoseLandmarkType.RightElbow] + - _transforms[PoseLandmarkType.RightShoulder]; + var absolutelyRotation = Quaternion.LookRotation(direction); - var relativeRot = _transforms[PoseLandmarkType.RightElbow] - _transforms[PoseLandmarkType.RightShoulder]; - relativeRot.Normalize(); - - var hipRot = _animator.GetBoneTransform(HumanBodyBones.Hips).rotation; - hipRot.Normalize(); - - var interal = Quaternion.FromToRotation(relativeRot, hipRot.eulerAngles); - interal.Normalize(); - - _animator.GetBoneTransform(HumanBodyBones.RightUpperArm).rotation = interal; //Quaternion.LookRotation(relativeRot + hipRot); + _animator.GetBoneTransform(HumanBodyBones.RightUpperArm).rotation + = absolutelyRotation * Quaternion.Inverse(_animator.GetBoneTransform(HumanBodyBones.Hips).rotation); }