void Update() { if (manager && manager.IsTracking()) { // set head position & rotation if (Head != null) { Vector3 newPosition = HeadInitialPosition + manager.GetHeadPosition(); Head.localPosition = Vector3.Lerp(Head.localPosition, newPosition, 3 * Time.deltaTime); Quaternion newRotation = HeadInitialRotation * manager.GetHeadRotation(); Head.localRotation = Quaternion.Slerp(Head.localRotation, newRotation, 3 * Time.deltaTime); } // get animation units int iAUCount = manager.GetAnimUnitsCount(); if (iAUCount >= 6) { // AU0 - Upper Lip Raiser // 0=neutral, covering teeth; 1=showing teeth fully; -1=maximal possible pushed down lip float fAU0 = manager.GetAnimUnit(0); SetJointRotation(UpperLipLeft, UpperLipLeftAxis, fAU0, UpperLipLeftNeutral, UpperLipLeftUp); SetJointRotation(UpperLipRight, UpperLipRightAxis, fAU0, UpperLipRightNeutral, UpperLipRightUp); // AU1 - Jaw Lowerer // 0=closed; 1=fully open; -1= closed, like 0 float fAU1 = manager.GetAnimUnit(1); SetJointRotation(Jaw, JawAxis, fAU1, JawNeutral, JawDown); // AU2 – Lip Stretcher // 0=neutral; 1=fully stretched (joker’s smile); -1=fully rounded (kissing mouth) float fAU2 = manager.GetAnimUnit(2); SetJointRotation(LipLeft, LipLeftAxis, fAU2, LipLeftNeutral, LipLeftStretched); SetJointRotation(LipRight, LipRightAxis, fAU2, LipRightNeutral, LipRightStretched); // AU3 – Brow Lowerer // 0=neutral; -1=raised almost all the way; +1=fully lowered (to the limit of the eyes) float fAU3 = manager.GetAnimUnit(3); SetJointRotation(EyebrowLeft, EyebrowLeftAxis, fAU3, EyebrowLeftNeutral, EyebrowLeftLowered); SetJointRotation(EyebrowRight, EyebrowRightAxis, fAU3, EyebrowRightNeutral, EyebrowRightLowered); // AU4 – Lip Corner Depressor // 0=neutral; -1=very happy smile; +1=very sad frown float fAU4 = manager.GetAnimUnit(4); SetJointRotation(LipCornerLeft, LipCornerLeftAxis, fAU4, LipCornerLeftNeutral, LipCornerLeftDepressed); SetJointRotation(LipCornerRight, LipCornerRightAxis, fAU4, LipCornerRightNeutral, LipCornerRightDepressed); // AU5 – Outer Brow Raiser // 0=neutral; -1=fully lowered as a very sad face; +1=raised as in an expression of deep surprise float fAU5 = manager.GetAnimUnit(5); SetJointRotation(OuterBrowLeft, OuterBrowLeftAxis, fAU5, OuterBrowLeftNeutral, OuterBrowLeftRaised); SetJointRotation(OuterBrowRight, OuterBrowRightAxis, fAU5, OuterBrowRightNeutral, OuterBrowRightRaised); } } }