Hi,
I’m trying to make a simple fighting game, and I’ve become stuck on a OnCollision problem.
I have two sprites each with a rigidbody2D and a sprite renderer on the parent, and each with a child object containing the colliders (both sprites colliders are setup as triggers) and the movement / detect hit scripts.
The circle collider on character A is off by default, character B’s is always on.
When the character A moves next to character B and throws a punch, I turn on character A’s circle collider using the event trigger in the animator.
The collider that is turned on is inside character B’s collider and is not detected in the script - which is where the problem lies.
I tried using the OnTriggerEnter2D, stay and exit but none of those register a collision.
I thought the physics2D.istouching would do it, but that doesn’t seem to work either (or at least not for me).
This whole punch all worked fine until I realised I needed Character B to have a rigidbody as well and now it won’t work.
I’m just not sure exactly which bit I’ve got wrong.
Any help / push in the right direction would be greatly appreciated.
Thanks
Steve