Animator的SetFloat接口可以设置阻尼,并且4种类型变量只有float是支持阻尼的。
public void SetFloat(int id, float value, float dampTime, float deltaTime);
当设置阻尼为0.2时
if (direction > ) direction = ;
else direction = ;
Debug.Log("Direction: " + direction);
animator.SetFloat("Direction", direction, 0.2f, Time.deltaTime);
测试结果
当设置阻尼为0时
if (direction > ) direction = ;
else direction = ;
Debug.Log("Direction: " + direction);
animator.SetFloat("Direction", direction, , Time.deltaTime);