お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Closeコライダーがトリガーかどうか
トリガーは、Rigidbodyと衝突しません。 Rgidbodyが侵入・進出した時は、 OnTriggerEnter と OnTriggerExit と OnTriggerStay のメッセージが代わりに送信されます。
// Turns the attached to collider into a trigger. collider.isTrigger = true;
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { collider.isTrigger = true; } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as void: collider.isTrigger = true