Search Unity

Undoing Physics.IgnoreCollision()?

Discussion in 'Scripting' started by MatthewW, Dec 13, 2006.

Thread Status:
Not open for further replies.
  1. MatthewW

    MatthewW

    Joined:
    Nov 30, 2006
    Posts:
    1,356
    Is there any way to undo the effects of Physics.IgnoreCollision()?

    For instance, I want to ignore collisions between a wall and an object for the first second of that object's life, but then resume collision checking.

    It's easy enough to implement this logic, except that I don't see any method to tell the physics engine I'd like to ignore the ignore (the IgnoreCollision documentation makes mention of circumstances in which the state is lost, but that seems like dangerous territory to deactivate/reactivate a rigidbody just to resume collision checks).
     
  2. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    Code (csharp):
    1. Physics.IgnoreCollision( yourCollider, yourOtherCollider, false );
     
    zeimhall, Stormer2020, Nefju and 4 others like this.
  3. MatthewW

    MatthewW

    Joined:
    Nov 30, 2006
    Posts:
    1,356
    D'oh! Not sure how I missed that.

    On second look at the documentation page, it was kind of hidden (some of the docs pages overlap for me).
     

    Attached Files:

  4. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    Ha. Just the part you needed. :)
     
    wardsmets likes this.
  5. thomskyCan

    thomskyCan

    Joined:
    May 20, 2022
    Posts:
    8
    Vincent454 likes this.
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
Thread Status:
Not open for further replies.