首页 文章

我的动画是滞后的,为什么?

提问于
浏览
-1

我有一个统一的动画,基本上它显示唐纳德特朗普运行:

enter image description here

我也有这个特朗普跳跃的一帧动画:

enter image description here

基本上,当他跳跃时,跳跃动画播放,当他降落时,步行动画再次播放 .

enter image description here

这一切都有效,这段代码运行它:

function Update() {
    trump.velocity = Vector2(speed, trump.velocity.y);
    if (jump > 0) {
        jumpBool = true;
    }
    else {
        jumpBool = false;
    }
    animator.SetBool("Jump", jumpBool);

这是在物理脚本中 . 然后从动画师:

enter image description here

enter image description here

这一切都有效,动画会在应有的时候发生变化 . 问题是,它在完成之前就滞后了 . 我认为当特朗普跳跃时,步行动画在切换到跳跃动画之前就完成了 . 我的问题是,如何立即自动切换动画,所以看起来不会那么迟钝?

1 回答

  • 1

    您可以立即调用Jump动画,以便在您使JumpBool = true时播放 . 这样做你不需要等待步行动画完成,它将简单地停止Walk并移动到Jump .

    function Update() {
        trump.velocity = Vector2(speed, trump.velocity.y);
        if (jump > 0) {
            animator.Play("Trump Jump");
            //jumpBool = true;
        }
        else {
            //jumpBool = false;
        }
        //animator.SetBool("Jump", jumpBool);
    

    enter image description here

    您甚至不需要设置bool,在Jump动画完成后它将移回Walk动画 .

    enter image description here

相关问题