动画状态的切换调整

 

从Idle状态转入Blend Tree(混合树),通过开关Bleed布尔值的调用

 

再通过代码的操作对其进行操作,先通过按键Q打开混合树,利用Float类型的Blend去调整数值,并改变其动画状态,关闭混合树时只需要按下W另其变成False自动关闭动画树,进入Idle状态。

public class HomeWorkGirlTree : MonoBehaviour
{
    private Animator an;
    // Start is called before the first frame update
    void Start()
    {
        an = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        
        float x = Input.GetAxis("Horizontal");
        an.SetFloat("Blend", x);
        if (Input.GetKeyDown(KeyCode.Q))
        {
            an.SetBool("Bleed", true);
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            an.SetBool("Bleed", false);
        }
    }
}

 

 

Logo

分享最新的 NVIDIA AI Software 资源以及活动/会议信息,精选收录AI相关技术内容,欢迎大家加入社区并参与讨论。

更多推荐