// Call OnAnimatorMove manually on the character controller because it doesn't have the Animator component void OnAnimatorMove() { // For not using root rotation in Turn value calculation Vector3 f = animator.deltaRotation * Vector3.forward; deltaAngle += Mathf.Atan2(f.x, f.z) * Mathf.Rad2Deg; characterController.Move(animator.deltaPosition, animator.deltaRotation); }
// Update the Animator with the current state of the character controller void Update() { float speed = moveSpeed.Evaluate(characterController.animState.moveDirection.z); // Locomotion animator.SetFloat("Speed", speed); // Movement characterController.Move(characterController.transform.forward * Time.deltaTime * speed, Quaternion.identity); }
// Call OnAnimatorMove manually on the character controller because it doesn't have the Animator component void OnAnimatorMove() { // For not using root rotation in Turn value calculation Vector3 f = animator.deltaRotation * Vector3.forward; deltaAngle += Mathf.Atan2(f.x, f.z) * Mathf.Rad2Deg; if (characterController.fullRootMotion) { characterController.transform.position += animator.deltaPosition; characterController.transform.rotation *= animator.deltaRotation; } else { characterController.Move(animator.deltaPosition, animator.deltaRotation); } }
// Call OnAnimatorMove manually on the character controller because it doesn't have the Animator component void OnAnimatorMove() { characterController.Move(animator.deltaPosition); }