Search Unity

IgnoreCollision in a specific PhysicsScene2D

Discussion in 'Physics' started by anthonyblond, Oct 6, 2019.

  1. anthonyblond

    anthonyblond

    Joined:
    Jul 3, 2019
    Posts:
    2
    (This question applies both to 3D and 2D physics, but my particular case is for 2D)

    I have 2 Physics2DScenes running in 'parallel' (I'm manually calling Simulate), I am trying to ignore collisions between certain objects in a specific physics scene.

    If I only had a single scene (the default physics scene), I could use the static Physics2D.IgnoreCollision, but that method is not available in PhysicsScene2D.

    In fact, this can be framed as a more general question: How do I do all the things I would normally do with Physics2D on a specific PhysicsScene2D?

    Is there are way to change the 'current physics scene' that the static calls in Physics2D act on?
     
  2. anthonyblond

    anthonyblond

    Joined:
    Jul 3, 2019
    Posts:
    2
    Ok, I think I see how it works now. Most of the static methods in Physics2D take a collider as a parameter, and since a collider can only be in a single scene the functionality is not ambiguous. Where it would be (for example LineCast), another method has been added to PhysicsScene2D.

    So my question doesn't actually make sense :)
    I'll leave this here in case anyone else runs into similar confusion.
     
    poweremil and MelvMay like this.