Version: 2017.1
public static void IgnoreCollision (Collider collider1, Collider collider2, bool ignore= true);

パラメーター

start 始点
end 終点
ignore Ignore collision.

説明

2 つのコライダーの衝突判定を無効化します

This is useful, say, for preventing projectiles from colliding with the object that fires them.

Note that IgnoreCollision will reset the trigger state of affected colliders, so you might receive OnTriggerExit and OnTriggerEnter messages in response to calling this.

IgnoreCollision にはいくつかの制約があります:

1) 永続しない。つまりシーン保存したとき IgnoreCollision 状態はエディターに格納されません。

2) 有効なゲームオブジェクトにしか IgnoreCollision を適用できません。



See Also: Physics.IgnoreLayerCollision.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform bulletPrefab; void Start() { Transform bullet = Instantiate(bulletPrefab) as Transform; Physics.IgnoreCollision(bullet.GetComponent<Collider>(), GetComponent<Collider>()); } }