Skip to content

Commit

Permalink
キャリブレーションが壊れていたのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-akira committed Nov 22, 2023
1 parent 11bcc88 commit 8b58c6b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Assets/Scripts/Avatar/MotionTracking/IKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ public void ModelInitialize()
{
wristRotationFix.SetVRIK(vrik);

animator.GetBoneTransform(HumanBodyBones.LeftLowerArm).eulerAngles = new Vector3(LeftLowerArmAngle, 0, 0);
animator.GetBoneTransform(HumanBodyBones.RightLowerArm).eulerAngles = new Vector3(RightLowerArmAngle, 0, 0);
animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).eulerAngles = new Vector3(LeftUpperArmAngle, 0, 0);
animator.GetBoneTransform(HumanBodyBones.RightUpperArm).eulerAngles = new Vector3(RightUpperArmAngle, 0, 0);

HandController.SetDefaultAngle(animator);

//初期の指を自然に閉じたポーズにする
Expand Down Expand Up @@ -402,7 +407,7 @@ private void SetVRIK(VirtualAvatar virtualAvatar)
FixArmDirection(virtualAvatar);
}

vrik = virtualAvatar.AddComponent<RootMotion.FinalIK.VRIK>();
vrik = virtualAvatar.AddComponent<VRIK>();
virtualAvatar.AddComponent<VRIKTimingManager>();
vrik.AutoDetectReferences();

Expand Down Expand Up @@ -703,6 +708,12 @@ public IEnumerator Calibrate(PipeCommands.CalibrateType calibrateType)
yield break;
}

animator.GetBoneTransform(HumanBodyBones.LeftLowerArm).localEulerAngles = new Vector3(0, 0, 0);
animator.GetBoneTransform(HumanBodyBones.RightLowerArm).localEulerAngles = new Vector3(0, 0, 0);
animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).localEulerAngles = new Vector3(0, 0, 0);
animator.GetBoneTransform(HumanBodyBones.RightUpperArm).localEulerAngles = new Vector3(0, 0, 0);
animator.GetBoneTransform(HumanBodyBones.LeftHand).localEulerAngles = new Vector3(0, 0, 0);
animator.GetBoneTransform(HumanBodyBones.RightHand).localEulerAngles = new Vector3(0, 0, 0);

SetVRIK(virtualAvatar);
wristRotationFix.SetVRIK(vrik);
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Avatar/MotionTracking/MotionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MotionManager : MonoBehaviour
private VRIK vrik;
private IKSolver ikSolver;

[SerializeField]
private List<VirtualAvatar> VirtualAvatars = new List<VirtualAvatar>();

private static MotionManager instance;
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Avatar/MotionTracking/VirtualAvatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace VMC
{
[Serializable]
public class VirtualAvatar
{
private Transform parent;
Expand Down

0 comments on commit 8b58c6b

Please sign in to comment.