Hi there,
I have a game object called Character with RigidBody2D and Box Collider2D attached to it. I’ve created a child of that object, called Axe, and attached a circle collider to it. alt text
Problem is that in script that handles the enemies, whenever I want to check if the collision between axe and enemy appeared nothing happens.
Here is a code I use in EnemyController to detect collision with that child:
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.CompareTag("Axe"))
{
EnemyAnim.SetBool("PlayerCollider", true);
Instantiate(blood, rb2D.transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
Any tips how to dectect a collision between child of character and enemy?
Thanks in advance!