Version: 2023.2
public bool isGrounded ;

描述

在上次移动期间 CharacterController 是否接触地面?

using UnityEngine;

public class Example : MonoBehaviour { CharacterController controller;

void Start() { controller = GetComponent<CharacterController>(); }

void Update() { if (controller.isGrounded) { print("CharacterController is grounded"); } } }