void OnRenderObject()
        {
            if (expressionSet == null)
            {
                return;
            }
            if (skeleton == null)
            {
                return;
            }

            expressionSet.RestoreBones(skeleton);
        }
Beispiel #2
0
        void Update()
        {
            if (!initialized)
            {
                Initialize();
                return;
            }

            // Fix for animation systems which require consistent values frame to frame
            Quaternion headRotation = umaData.skeleton.GetRotation(headHash);
            Quaternion neckRotation = umaData.skeleton.GetRotation(neckHash);

            // Need to reset bones here if we want Mecanim animation
            expressionSet.RestoreBones(umaData.skeleton, logResetErrors);

            if (!overrideMecanimNeck)
            {
                umaData.skeleton.SetRotation(neckHash, neckRotation);
            }
            if (!overrideMecanimHead)
            {
                umaData.skeleton.SetRotation(headHash, headRotation);
            }

            if (gazeWeight > 0f)
            {
                if (umaData.animator != null)
                {
                    umaData.animator.SetLookAtPosition(gazeTarget);
                    umaData.animator.SetLookAtWeight(gazeWeight);
                }
            }
        }
Beispiel #3
0
        void Update()
        {
            if (!initialized || umaData == null)
            {
                Initialize();
                return;
            }

            if (!processing)
            {
                return;
            }

            if (_mainCameraTransform != null && useDisableDistance && (_mainCameraTransform.position - transform.position).sqrMagnitude > (disableDistance * disableDistance))
            {
                return;
            }

            // Fix for animation systems which require consistent values frame to frame
            Quaternion headRotation = Quaternion.identity;
            Quaternion neckRotation = Quaternion.identity;

            if (!overrideMecanimHead && headHash != 0)
            {
                headRotation = umaData.skeleton.GetRotation(headHash);
            }
            if (!overrideMecanimNeck && neckHash != 0)
            {
                neckRotation = umaData.skeleton.GetRotation(neckHash);
            }

            // Need to reset bones here if we want Mecanim animation
            expressionSet.RestoreBones(umaData.skeleton, logResetErrors);

            if (!overrideMecanimNeck && neckHash != 0)
            {
                umaData.skeleton.SetRotation(neckHash, neckRotation);
            }
            if (!overrideMecanimHead && headHash != 0)
            {
                umaData.skeleton.SetRotation(headHash, headRotation);
            }

            if (gazeWeight > 0f)
            {
                if (umaData.animator != null)
                {
                    umaData.animator.SetLookAtPosition(gazeTarget);
                    umaData.animator.SetLookAtWeight(gazeWeight);
                }
            }
        }
Beispiel #4
0
        void Update()
        {
            if (!initialized)
            {
                return;
            }

            // Need to reset bones here if we want Mecanim animation
            expressionSet.RestoreBones(umaData.skeleton, logResetErrors);

            if (gazeWeight > 0f)
            {
                if (umaData.animator != null)
                {
                    umaData.animator.SetLookAtPosition(gazeTarget);
                    umaData.animator.SetLookAtWeight(gazeWeight);
                }
            }
        }
Beispiel #5
0
        void Update()
        {
            if (!initialized || umaData == null)
            {
                Initialize();
                return;
            }

            if (!processing)
            {
                return;
            }

            if (_mainCameraTransform != null && useDisableDistance && (_mainCameraTransform.position - transform.position).sqrMagnitude > (disableDistance * disableDistance))
            {
                return;
            }

            // Fix for animation systems which require consistent values frame to frame
            Quaternion headRotation = Quaternion.identity;
            Quaternion neckRotation = Quaternion.identity;

            try
            {
                if (umaData.skeleton.GetBoneGameObject(headHash) == null)
                {
                    return;
                }
                headRotation = umaData.skeleton.GetRotation(headHash);
            }
            catch (System.Exception ex)
            {
                Debug.LogException(ex);
                Debug.LogError("GetRotation: Head Bone not found!");
            }

            try
            {
                if (umaData.skeleton.GetBoneGameObject(neckHash) == null)
                {
                    return;
                }
                neckRotation = umaData.skeleton.GetRotation(neckHash);
            }
            catch (System.Exception) { Debug.LogError("GetRotation: Neck Bone not found!"); }

            // Need to reset bones here if we want Mecanim animation
            expressionSet.RestoreBones(umaData.skeleton, logResetErrors);

            if (!overrideMecanimNeck)
            {
                umaData.skeleton.SetRotation(neckHash, neckRotation);
            }
            if (!overrideMecanimHead)
            {
                umaData.skeleton.SetRotation(headHash, headRotation);
            }

            if (gazeWeight > 0f)
            {
                if (umaData.animator != null)
                {
                    umaData.animator.SetLookAtPosition(gazeTarget);
                    umaData.animator.SetLookAtWeight(gazeWeight);
                }
            }
        }