当前位置:   article > 正文

AnimatorStateInfo 状态机信息 动画激活 动画结束_animatorstateinfo.normalizedtime

animatorstateinfo.normalizedtime

动画状态机怎么判断动画是否播完了?

AnimatorStateInfo.normalizedTime

  float normalizedTime;
  Description:
  Normalized time of the State.
  The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.

  2. 代码如下:

  private Animator animator;

  void Start()
  {
       animator = this.GetComponent<Animator>();
  }

  void Update()
  {
      AnimatorStateInfo  info = animator.GetCurrentAnimatorStateInfo(0);
    // 判断动画是否播放完成
      if( info.normalizedTime >= 1.0f)
      {
          DoSomething();
      }
  }


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号