我试图直接与玩家(父母与刚体)联系时继续碰撞;并忽略与孩子的碰撞(剑)。 剑是标记的武器,玩家是玩家。
我搜索过,找不到足够的答案(C#)
$
这让我发疯,我需要睡觉,请帮助。
编辑 - 我用了一个简单的东西叫做ContactPoint.otherCollider
,经过多年的努力解决了这个问题答案 0 :(得分:0)
问题可能在于您如何检查标签。 我通常直接抓住gameObject的标签。
islamic_day_names = ["Al Ithnayn", "Ath Thulatha", "Al Arbia",
"Al khamis", "Al Jumuah", "As Sabt", "Al Ahad"]
hijri_date[0] = islamic_day_names[weekday_number] # 0 <= weekday_number <= 6
甚至是对撞机的标签。
void OnCollisionEnter(Collision col){
if (col.gameObject.tag == "Player"){
//stuff happens
}
}
答案 1 :(得分:0)
In case anyone else is struggling with this and OP's edit was too vague...
You can check to see the colliders that were hit on the GameObject calling the script using collision.contacts:
foreach (ContactPoint c in collision.contacts)
{
Debug.Log(c.thisCollider.name);
}