CharacterController.isGrounded 是否地面
var isGrounded : bool
Description描述
Was the CharacterController touching the ground during the last move?
在最后的移动角色控制器是否触碰地面?
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {void Update() {CharacterController controller = GetComponent<CharacterController>();if (controller.isGrounded)print("We are grounded");}}
function Update () {var controller : CharacterController = GetComponent(CharacterController);if (controller.isGrounded)print("We are grounded");}