Unity-Animato深入系列---FloatValue阻尼

回到 Animator深入系列总目录

 

Animator的SetFloat接口可以设置阻尼,并且4种类型变量只有float是支持阻尼的。

public void SetFloat(int id, float value, float dampTime, float deltaTime);

 

 

当设置阻尼为0.2时

if (direction > 0) direction = 1;
else direction = 0;
Debug.Log("Direction: " + direction);
animator.SetFloat("Direction", direction, 0.2f, Time.deltaTime);

 

测试结果

 

 

当设置阻尼为0时

if (direction > 0) direction = 1;
else direction = 0;
Debug.Log("Direction: " + direction);
animator.SetFloat("Direction", direction, 0, Time.deltaTime);

 

posted @ 2015-12-29 16:15  HONT  阅读(2412)  评论(0编辑  收藏  举报