[英]Trigger is not detecting Collisions with other colliders
我的場景中有一個 Rocket GameObject,我只希望它與某些對象發生碰撞,因此我將其設為觸發器並在它與某物碰撞時檢查標簽。 一切都很順利,直到我決定將這個功能添加到我的炮塔中,我做了一些測試並且火箭沒有檢測到它何時與炮塔物體發生碰撞(順便說一下,它們都在 Z=0 上)。
提前感謝任何幫助的人!
這是火箭腳本:
void OnTriggerEnter2D(Collider2D other)
{
UnityEngine.Debug.Log("Collision Detected with" + other);
if (other.gameObject.tag == "Player")
{
PlayerController.health -= 75.0f;
Die();
}
if (other.gameObject.tag == "Boss 1")
{
Boss1Controller.health -= 100;
Die();
}
if (other.gameObject.tag == "Turret")
{
Destroy(other);
}
}
以下是炮塔游戲 Object 和火箭游戲對象的一些圖像:
沒關系,我想通了,事實證明觸發器不適用於Edge Colliders2D
,所以我只使用了Polygon Collider2D
。 形狀不像以前那么完美,但已經足夠好了。
新手錯誤,對不起。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.