Hello!
I want to register collision when it happens inside BoxCollider2D and instantiate hit effect at that point, but when I try to determine the point using collision.GetContact(0).point I receive the point which is actually outside of the box collider.
void OnCollisionStay2D(Collision2D collision) {
Instantiate(hitEffect, collision.GetContact(0).point, Quaternion.identity);
Destroy(gameObject);
}
I got the result:
Appreciate your help in advance, guys!
UPD: I think I can add a condition and if the bullet is inside the container instantiate hit effect at the firepoint pisition. But it seems to be a duct tape code and I’m not sure this will work.