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

School Project 25600 rigidbodies

Discussion in 'Physics' started by kqmdjc8, May 28, 2019.

  1. kqmdjc8

    kqmdjc8

    Joined:
    Jan 3, 2019
    Posts:
    102
    Hello, I have a strange task to do on my IT studies. I have to make a simple 2D asteroid shooter game but also there must be 25600 asteroids on the scene and all of them have to be rigidbodies as they need to destroy itself and respawn on collision with other asteroid or bullet. There is condition that all of them must be active at all time. Also asteroids have to soawn with random rotation and velocity.

    I have the main game mechanic but my unity can only handle about 5000 asteroids.I have blocked rigidbodies' rotation as they do not interact with other but only destroy itself. Also I've tried to change fixed timestep from 0.02 to for example 0.03 or 0.04 but game becomes laggy then.

    What optimization steps can I make? I also would like to turn off calculating bounce after touching another rigidbody as it is useless in my game and things doesn't bounce off itselves. How do I achieve that?
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Use primitive colliders
    Increase fixed time step
    There 2 more values in the Time settings that you can lower to increase performence(in the cost of accuracy) but i dont remember the names, they start with values of like 6 or 7.
     
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Also, this seems like a weird assignment.

    I'd understand a task of faking it(smoke&mirror is life), but this seems like its of no use and a slim possibility to actually work.
    Did they show you guys a demo they made with this many rigidbodies?
    Just sounds excessive.
     
    Last edited: May 28, 2019
    xVergilx and Vryken like this.
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    ECS is probably the way to go here, but I can't really recommended it too much considering it's not fully implemented yet.
    Why your professor wants exactly 25600 active Rigidbodies in the scene is beyond me.
     
    xVergilx and SparrowGS like this.
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    does the assignment really say they require actual unity rigidbodies there, or the requirement is collisions?
    it would sound more reasonable that you need to optimize such large amount of objects and collisions using some space partitioning system..
     
    SparrowGS likes this.
  6. kqmdjc8

    kqmdjc8

    Joined:
    Jan 3, 2019
    Posts:
    102
    They don't really require rigidbodies but simulated physics - collisions etc.
     
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350