Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Colliders go through each other for a few frames; is this acceptable visually since its so short?

Discussion in 'Physics' started by tfishell, Nov 8, 2018.

  1. tfishell

    tfishell

    Joined:
    Nov 20, 2017
    Posts:
    56
    This is just something I've been wondering for a while. I'm working on a 2D platformer, and the collider2d on the player/dynamic rigidbody2d goes through the ground/boxcollider2d for a few frames. I assume for a small cheap beginner game this is acceptable visually. (I believe the "through each other for a few frames" could be avoided using kinematic + scripting - I have been following a Sebastian Lague tutorial that seems to do this - but I'd prefer not to worry about that right now because I have plenty left to try to do and learn for the game.) In any case, I was curious what recommendations folks here have or what the "standard(s)" are. Thanks.

    Gif: https://imgur.com/504oziu
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    768
    tfishell likes this.
  3. tfishell

    tfishell

    Joined:
    Nov 20, 2017
    Posts:
    56
    I actually hadn't really, thanks. Is it recommended to switch the mode via scripting depending on the velocity or the difference in position between frames ("delta movement"?), or is it okay to leave it as "Continuous" if my work isn't graphically intensive or not many gameobjects onscreen at once?
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    768
    That's an interesting question. I've never dynamically changed the Collision Detection Mode. I always decide on it based on the expected behavior of the object, depending on how fast I think it will be moving. I'm not sure whether there are any issues with changing it on the fly, though I can imagine some cases where that might result in a bad outcome. Such as: what if a stationary object is struck by a very fast moving object. I'd probably just leave it as Continuous unless it's an actual performance issue. (Assuming Continuous actually does help keep your object from penetrating the floor as much.)
     
    tfishell likes this.
  5. tfishell

    tfishell

    Joined:
    Nov 20, 2017
    Posts:
    56
    Absolutely in my case.