Animator——新建一个混合树Roll
ThirdPersonRoll
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class ThirdPersonRoll : MonoBehaviour
{Animator animator;void Awake(){animator = GetComponent<Animator>();}// Update is called once per framevoid Update(){if (Input.GetKeyDown(KeyCode.LeftShift))animator.SetTrigger("roll");}
}
PlayerController
#region 角色输入控制#region 水平方向float h = Input.GetAxis("Horizontal");float v = Input.GetAxis("Vertical");animator.SetFloat("AxisY", h);animator.SetFloat("AxisX", v);