Пример #1
0
        // Update the Animator with the current state of the character controller
        void Update()
        {
            if (Time.deltaTime == 0f)
            {
                return;
            }

            // Crossfading
            if (characterController.animState.moveDirection.z > 0.4f)
            {
                animation.CrossFade(moveName, 0.1f);
            }
            else
            {
                animation.CrossFade(idleName);
            }

            // Moving
            characterController.Move(characterController.transform.forward * Time.deltaTime * moveSpeed.Evaluate(characterController.animState.moveDirection.z));
        }
Пример #2
0
 // Call OnAnimatorMove manually on the character controller because it doesn't have the Animator component
 void OnAnimatorMove()
 {
     characterController.Move(animator.deltaPosition);
 }