Collider.isTrigger 是触发器?

var isTrigger : bool


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