protected virtual void CopyPoseImp() { //For some obscure reason, we have to set source and dest to null parent in order to work. QuickHumanPoseHandler.GetHumanPose(_source, ref _poseSource); QuickHumanPoseHandler.GetHumanPose(_dest, ref _poseDest); foreach (QuickHumanBodyBones boneID in _allJoints) { if (!IsTrackedJoint(boneID)) { for (int i = 0; i < 3; i++) { int m = QuickHumanTrait.GetMuscleFromBone(boneID, i); if (m != -1) { _poseSource.muscles[m] = _poseDest.muscles[m]; } } } } //The hips is a special case, it modifies the bodyPosition and bodyRotation fields if (!IsTrackedJointBody(TrackedJointBody.Hips)) { _poseSource.bodyPosition = _poseDest.bodyPosition; _poseSource.bodyRotation = _poseDest.bodyRotation; } QuickHumanPoseHandler.SetHumanPose(_dest, ref _poseSource); }
protected virtual void UpdateStatePlaying(float time) { transform.position = _playAnimationClip.EvaluateTransformPosition(time); transform.rotation = _playAnimationClip.EvaluateTransformRotation(time); if (_animator.isHuman) { _playAnimationClip.EvaluateHumanPose(time, ref _humanPose); QuickHumanPoseHandler.SetHumanPose(_animator, ref _humanPose); } }
public virtual void SetAnimatorDest(Animator animator) { //Restore the initial HumanPose that _dest had at the begining if (_dest) { QuickHumanPoseHandler.SetHumanPose(_dest, ref _initialPoseDest); } _dest = animator; //Save the current HumanPose of the new _dest if (_dest) { QuickHumanPoseHandler.GetHumanPose(_dest, ref _initialPoseDest); } }