Exemple #1
0
        void ApplyHumanPose()
        {
            if (poseHandler == null)
            {
                poseHandler = new HumanPoseHandler(skeleton.root.GetComponent <Animator>().avatar, skeleton.root);
                poseHandler.GetHumanPose(ref humanPose);
            }
            var motions = decoder.motions;

            System.Array.Resize(ref swingTwists, HumanTrait.BoneCount);
            for (int i = 0; i < HumanTrait.BoneCount; i++)
            {
                swingTwists[i] = motions[i].t;
            }
            HumanPoser.SetBoneSwingTwists(ref humanPose, swingTwists);
            HumanPoser.SetHipsPositionRotation(ref humanPose, motions[0].t, motions[0].q, motions[0].s);
            poseHandler.SetHumanPose(ref humanPose);
            ApplyScale();
        }
Exemple #2
0
        public void TakeSnapshot(float deltaTime)
        {
            if (humanPoseHandler == null)
            {
                humanPoseHandler = new HumanPoseHandler(animator.avatar, animator.transform);
            }
            humanPoseHandler.GetHumanPose(ref humanPose);

            (proxies[0].localPosition, proxies[0].localRotation) = HumanPoser.GetRootMotion(ref humanPose, animator);
            for (int i = 1; i < HumanTrait.BoneCount; i++)
            {
                var pos = Vector3.zero;
                for (int j = 0; j < 3; j++)
                {
                    if (MuscleFromBone[i, j] >= 0)
                    {
                        pos[j] = humanPose.muscles[MuscleFromBone[i, j]];
                    }
                }
                proxies[i].localPosition = pos;
            }
            recorder.TakeSnapshot(deltaTime);
        }