private void UpdateMuscleIndices(int[] indices, PoseAnimator animator, bool isStart = false)
        {
            animator.UpdatePose();
            var poseList = isStart ? StartPose: TargetPose;

            for (int m = 0; m < indices.Length; m++)
            {
                var muscleIndex = indices[m];
                var value       = animator.HumanPose.muscles[muscleIndex];
                //animator.UpdateMuscle(muscleIndex, value);
                bool foundIndex = false;
                for (int s = 0; s < poseList.Count; s++)
                {
                    if (poseList[s].MuscleIndex == muscleIndex)
                    {
                        poseList[s].Value = value;
                        foundIndex        = true;
                        break;
                    }
                }
                if (!foundIndex)
                {
                    poseList.Add(new SavedMuscle(muscleIndex, value));
                }
            }
        }
Example #2
0
 private void Setup(Playable playable)
 {
     _started  = true;
     _duration = (float)playable.GetDuration();
     Animator  = PoseAnimator.Main;
     Animator.UpdatePose();
     SetupPoseTransition(Animator.DefaultPose);
 }
Example #3
0
 public void SetPose(PoseAnimator animator)
 {
     animator.UpdatePose();
     for (int i = 0; i < Pose.Count; i++)
     {
         animator.HumanPose.muscles[Pose[i].MuscleIndex] = Pose[i].Value;
     }
     animator.RefreshPose();
 }
 private void Setup(Playable playable)
 {
     _started   = true;
     _duration  = (float)playable.GetDuration();
     _easeFunc  = Easing.Function(EaseType);
     _startTime = TimeManager.Time;
     Animator   = PoseAnimator.Main;
     Animator.UpdatePose();
     for (int i = 0; i < Pose.Count; i++)
     {
         Pose[i].Start = Animator.HumanPose.muscles[Pose[i].MuscleIndex];
     }
 }
Example #5
0
 private void UpdateMuscleIndices(int[] indices, PoseAnimator animator)
 {
     animator.UpdatePose();
     for (int m = 0; m < indices.Length; m++)
     {
         var muscleIndex = indices[m];
         var value       = animator.HumanPose.muscles[muscleIndex];
         //animator.UpdateMuscle(muscleIndex, value);
         var muscle = GetMuscle(muscleIndex);
         if (muscle == null)
         {
             muscle = new SavedMuscle(muscleIndex, value);
             Pose.Add(muscle);
         }
         else
         {
             muscle.Value = value;
         }
     }
 }
Example #6
0
 private void Setup(Playable playable)
 {
     _started  = true;
     _duration = (float)playable.GetDuration();
     Animator  = PoseAnimator.Main;
     Animator.UpdatePose();
     #if UNITY_EDITOR
     if (!Application.isPlaying)
     {
         return;
     }
     #endif
     if (!UpdateStart)
     {
         return;
     }
     for (int i = 0; i < Pose.Count; i++)
     {
         Pose[i].Start = Animator.HumanPose.muscles[Pose[i].MuscleIndex];
     }
 }
Example #7
0
 private void UpdateMuscleIndices(int[] indices, PoseAnimator animator)
 {
     animator.UpdatePose();
     for (int m = 0; m < indices.Length; m++)
     {
         var muscleIndex = indices[m];
         var value       = animator.HumanPose.muscles[muscleIndex];
         //animator.UpdateMuscle(muscleIndex, value);
         bool foundIndex = false;
         for (int s = 0; s < Pose.Count; s++)
         {
             if (Pose[s].MuscleIndex == muscleIndex)
             {
                 Pose[s].Value = value;
                 foundIndex    = true;
                 break;
             }
         }
         if (!foundIndex)
         {
             Pose.Add(new SavedMuscle(muscleIndex, value));
         }
     }
 }