add: 添加新的控制思路

This commit is contained in:
jackfiled 2023-03-27 13:11:01 +08:00
parent d901880eea
commit 479e64907f

View File

@ -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);
}