Collider.isTrigger 是触发器?

var isTrigger : bool

Description描述

Is the collider a trigger?

碰撞器是一个触发器?

A trigger doesn't collide with rigid bodies. Instead it sends OnTriggerEnter, OnTriggerExit and OnTriggerStay message when a rigidbody enters or exits the trigger.

触发器不会与刚体碰撞。当一个刚体进入或退出触发器,将发送OnTriggerEnter, OnTriggerExit 和 OnTriggerStay消息。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		collider.isTrigger = true;
	}
}
// Turns the attached to collider into a trigger.
//转换附加的碰撞器为一个触发器
collider.isTrigger = true;
Page last updated: 2013-7-12