第三人称——翻滚系统

Animator——新建一个混合树Roll

1753942037489

1753942053284

1753942508450

1753942517964

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);
posted @ 2025-07-31 18:24  EanoJiang  阅读(15)  评论(0)    收藏  举报