Version: 2017.2

Physics.IgnoreCollision

매뉴얼로 전환
public static void IgnoreCollision (Collider collider1, Collider collider2, bool ignore= true);

파라미터

start Start point.
end End point.
ignore Ignore collision.

설명

Makes the collision detection system ignore all collisions between collider1 and collider2.

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

IgnoreCollision has a few limitations: 1) It is not persistent. This means ignore collision state will not be stored in the editor when saving a scene. 2) You can only apply the ignore collision to colliders in active game objects.

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>()); } }