29 lines
697 B
C#
29 lines
697 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AnimatorSpeedChecker : MonoBehaviour
|
|
{
|
|
public float animatorSpeed;
|
|
public float realSpeed;
|
|
private Animator animator;
|
|
private Vector3 prevPosition;
|
|
|
|
private void OnEnable()
|
|
{
|
|
animator = GetComponent<Animator>();
|
|
prevPosition = transform.position;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (animator != null)
|
|
{
|
|
animatorSpeed = animator.velocity.magnitude;
|
|
}
|
|
realSpeed = Vector3.Distance(transform.position, prevPosition) / Time.deltaTime;
|
|
prevPosition = transform.position;
|
|
}
|
|
}
|