Version: 2017.3

Physics.IgnoreCollision

Cambiar al Manual
public static void IgnoreCollision (Collider collider1, Collider collider2, bool ignore= true);

Parámetros

start Punto inicial.
end Punto final.
ignore Ignore collision.

Descripción

Hace que el sistema de detección de colisiones ignore todas las colisiones entre collider1 y collider2.

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 has a few limitations: 1) No es persistente. Esto significa que el estado de colisión ignorado no se almacenará en el editor al guardar una escena. 2) Sólo puede aplicar la ignore collision (ignorar colisiones) a colliders en game objects activos.

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>()); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961