Search Unity

Bug Collision only on vertical, not horizontal. Why?

Discussion in 'Physics' started by XIIl_, Oct 25, 2022.

  1. XIIl_

    XIIl_

    Joined:
    Jul 21, 2021
    Posts:
    25
    Hi!

    In my top down view game, my player intantiate in front of his body a slash vfx that have a own collider2D. This collider is with the trigger checked and a script to apply damage on other objects that collide with vfx. To detect the objects, i just did this:

    Code (CSharp):
    1. private void OnTriggerEnter2D(Collider2D collision)
    2. {
    3.         Debug.Log(collision);
    4. }
    My box have a simple BoxCollider2D, both box and slash vfx in layers that have collisions enabled, and when i try to hit the box, the collision only works if the player is in a vertical position from the box, horizontal doesn't work.



    As you can see, the colliders in both situation would supposed to trigger the OnTriggerEnter2D().
    All the others objects that can be attacked, enemies and boss, worked normal receiving the attack from any direction, horizontal, vertical, diagonal, just the box have this.

    Do you have any idea why this is happening?
     
  2. XIIl_

    XIIl_

    Joined:
    Jul 21, 2021
    Posts:
    25