0

I'm making a fighter game in Unity. When I punch I need to find a way for Unity to detect that if I'm hitting the opponent. The problem is that I don't seem to find a way to do so. Isn't there a way to make it detect if the meshes are touching each other or maybe some better way.

Do you have any ideas?

Regards, Robert Dan

4

2 回答 2

0

我会看看Physics.SphereCastAll。球体投射类似于射线投射。考虑球体投射一个厚的射线投射。这背后的想法是从出拳的起点向出拳的方向投射一个球体。如果从函数返回任何对撞机,那么您就知道它撞到了什么东西,所以您只需要检查它撞到的东西是否满足正确的条件(即另一个玩家)。

于 2013-04-10T20:04:15.283 回答
0

最明显的解决方案是将网格碰撞器和运动学刚体添加到您正在攻击的网格中,并使用 OnCollisionEnter 检测与其他刚体的碰撞。

于 2013-04-11T18:02:00.757 回答