ControllerColliderHit.gameObject 游戏物体

var gameObject : GameObject

Description描述

The game object that was hit by the controller.

控制器碰到的游戏物体。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnControllerColliderHit(ControllerColliderHit hit) {
		hit.gameObject.transform.position = Vector3.zero;
	}
}
// Objects we touch, move them to position (0, 0, 0)
//我们碰到的物体,移动到位置(0, 0, 0)
function OnControllerColliderHit(hit : ControllerColliderHit) {
	hit.gameObject.transform.position = Vector3.zero;
}
Page last updated: 2010-12-23