第三人称——翻滚系统
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 frame
void 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);

浙公网安备 33010602011771号