ControllerColliderHit.rigidbody 刚体

var rigidbody : Rigidbody

Description描述

The rigidbody that was hit by the controller.

由控制器碰到的刚体。

null if we didn't touch a rigidbody but a static collider.

如果我们不触碰一个刚体返回null,仅是一个静态碰撞器。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnControllerColliderHit(ControllerColliderHit hit) {
		if (typeof(hit) != null)
			hit.rigidbody.useGravity = true;

	}
}
// Activate the gravity of other object we touch
//激活我们接触的其他物体的重力
function OnControllerColliderHit(hit : ControllerColliderHit) {
	if(hit != null) {
		hit.rigidbody.useGravity = true;
	}
}
Page last updated: 2010-12-23