Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Physics2D.IgnoreCollision not work when rb not moving

Discussion in 'Physics' started by kole_dole, Oct 18, 2020.

  1. kole_dole

    kole_dole

    Joined:
    Jul 8, 2018
    Posts:
    8
    Hi,

    I want to use Physics2D.IgnoreCollision for ignoring collision between enemy and player, when player have shield.
    But I have enemy who some time is static and some time jump only on y axis. When enemy not moving Physics2D.IgnoreCollision not work and physics collision between player and enemy occur even Physics2D.IgnoreCollision is called. When i add some velocity to enemy in update method
    Code (CSharp):
    1. rb.velocity = new Vector2(0.1f, rb.velocity.y);
    IgnoreCollision work like it should.

    Can some one tell me why this happens?


    Thanks