动画状态机

1.创建动画状态机管理器(Animator Controller)

2.将动画拖入动画状态机(Animator)

3.修改模型的刚体属性,选择最适配的动画类型(Animation Type),显现模型骨骼

4.设置各个动画之间的导向,并创建切换状态条件(int,float,bool,trigger),通过脚本切换

5.动画重定向:将旧模型的动画给新模型使用,判断适配度,错误级别以下可以共同使用

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/*
*创建者:
*创建时间:
*描述:
*版本:
*/
public class _3_1 : MonoBehaviour
{
    Animator an;
    // Start is called before the first frame update
    void Start()
    {
        an=GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))//数值类型参数设置符合对应类型并且满足条件的数值;
        {
            an.SetFloat("Walk",1.0f);
            an.SetFloat("Run",0f);
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            an.SetFloat("Run",1f);
        }
        if (Input.GetKeyDown(KeyCode.E))//触发器设置的参数为动画的方法名
        {
            an.SetTrigger("Jump");
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            an.SetFloat("Walk", 0f);
            an.SetFloat("Run", 0f);
        }
    }
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值