Search Unity

How many rigidbodies with colliders until performance issues begin?

Discussion in 'Physics' started by kennethrunescape2019, Jan 6, 2020.

  1. kennethrunescape2019

    kennethrunescape2019

    Joined:
    Feb 5, 2019
    Posts:
    109
    Using a mid level computer, how many rigidbodies with box colliders are needed to start producing noticeable performance issues?

    Also what if we were to put all those colliders on one rigidbody? How much performance would be saved?

    I am not at my computer right now to test either of these and might be a few days before I return.

    Thanks to anyone who can give an answer.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,456
    Having a physics object is only part of the cost (somethings it's practically zero). A lot of the time the cost comes from how it interacts with other physics objects i.e. contacts, collision response etc. The pure overhead of it being there tends to be small.

    Your question therefore is far too simplified and vague (you don't even specify whether this is 2D or 3D physics) so there isn't a specific number to answer for this. As you've already hinted, you're best to run your own tests on your "mid level computer" using the profiler and see if the results are satisfactory for your project.
     
  3. kennethrunescape2019

    kennethrunescape2019

    Joined:
    Feb 5, 2019
    Posts:
    109

    Would it save performance to use one convex mesh collider than several box colliders?

    I am making a block based ship building game and was just wondering if using mesh colliders for each chunk of the ship would save more resources than using several box colliders.
     
  4. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    396
    I'm afraid noone will be able to answer you that, there are simply too many variables.
    It's almost always the case with as complex software as games.
    The only way you can find out is to test, test and test again(profiler).
     
    MelvMay likes this.