CharacterController.isGrounded 是否地面

var isGrounded : bool

Description描述

Was the CharacterController touching the ground during the last move?

在最后的移动角色控制器是否触碰地面?

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");
}
最后修改:2010年12月14日 Tuesday 13:31

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。