Hello
I am trying to detect collisions with walls so i can change enemy direction movement & rotate it face.
i use RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.right,1f); (in case the enemy face is to the left)
This code is inside the enemy object.
the issue is that it always detects the enemy … like it detect its inner self collider all the time instead of detecting other collisions (colliders) so the enemy can rotate to the other direction if hit a wall .
any solutions for this?