Unity之Animator组件

Animator组件

在这里插入图片描述

  • Controller:对应的动画控制器

  • Avatar:对应的替身配置信息

  • Apply Root Motion:是否启用动画位移更新

  • UpdateMode:更新模式

    Normal:正常更新
    Animate Physics:物理更新
    Unscaled Time:不受时间缩放影响

  • Culling Mode:裁剪剔除模式

    Always Animate:始终播放动画,即使在屏幕外也不剔除
    Cull Update Transforms:摄像机没有渲染该物体时,停止位置、IK的写入
    Cull Completely:摄像机没有渲染物体时,整个动画被完全禁用

Animator中的API

        animator = this.GetComponent<Animator>();
        1.通过状态机条件切换动画
        animator.SetFloat("条件名", 想设置的值);
        animator.SetInteger("条件名", 想设置的值);
        animator.SetBool("条件名", true或False);
        animator.SetTrigger("条件名");
		//也可以得到值
        animator.GetFloat("条件名");
        animator.GetInteger("条件名");
        animator.GetBool("条件名");

        2.直接切换动画 除非特殊情况 不然一般不使用
        animator.Play("状态名");

猜你喜欢

转载自blog.csdn.net/winds_tide/article/details/128943510