Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Physics performance regression in Unity 2022.3.8 and onwards

Discussion in 'Physics' started by PandaArcade, Sep 25, 2023.

  1. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    We have noticed a severe physics performance regression in 2022.3.8 and onwards. I have tested 2022.3.8, 2022.3.9, and 2022.3.10.

    Our game is relatively physics-heavy and runs fine in 2022.3.7, but is unplayable in 2022.3.8. The frame rate is fine, but the physics is surging and stuttering, likely due to the physics calculations exceeding the target frame time and being delayed until the Maximum Allowed Timestep.

    I'm very busy for the next few weeks, but I will try to find time to submit a bug report.
     
  2. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey Panda,

    Have you noticed any issues/changes with your physics in these newer versions? We updated from 2021 LTS -> 2022.3.10 LTS and it seems like all joint strengths need changing and all overlapping colliders fly away from one another instead of suitably resolving the collision.

    Thanks!
    Colton
     
    MitchStan likes this.
  3. leebissessar5

    leebissessar5

    Joined:
    Nov 15, 2022
    Posts:
    48
    I'm facing this issue as well. I checked my quadcopter simulation and had the propellers speeds equal so it should not rotate at all. But in 3.10, it's rolling and spazzing like crazy. Will roll back to 2021 LTS for the time being.
     
    PandaArcade likes this.
  4. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    I have done some tests in a simple project, but I haven't been able to reproduce the issue. In my test, I dropped many Rigidbody cubes connected in a chain with spring joints. The cubes are changing their material based on whether they are colliding. The cubes also have a constant force applied to them. I tried using mesh colliders instead of box colliders, but it made little difference.

    The issue is also still present in 2023.2.0b17.
     
  5. Kingstantin_unity

    Kingstantin_unity

    Joined:
    Sep 10, 2022
    Posts:
    10
    Same in 2023.3.14f1

    Suddenly falling objects start to move slower till they reach full speed. It's really odd,
     
  6. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    These issues seem to be related to PhysX being updated to 4.1.2. I can't find the exact version of Unity when this happened, but based on this thread and this issue it seems to line up with what we're experiencing, 2022.3.8 and onwards.
     
  7. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    I managed to reproduce the bug in a simple project and have submitted a bug report. I'll post updates here about how that goes for those who are interested.

    It occurs when a heavy(mass = 2000) fast-moving rigidbody collides with a light(mass = 1) rigidbody. In the following video, you can see the large sphere roll through the small green cubes and stutter in Unity 2022.3.8f1 and run perfectly fine in Unity 2022.3.7f1.



    Btw the issue is still present in Unity 2023.2.11f1.
     
    Last edited: Feb 28, 2024
  8. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    Issue Tracker Link - Unity has marked this issue as Won't Fix o_O

    Mass ratios greater than 10:1 are generally unstable and people are advised against using them with PhysX.

    However, switching the solver to Temporal Gauss Seidel, which offers better convergence with high mass ratios fixes the problem.
    ... so I can't have something with a mass of 11 collide with something with a mass of 1?

    LOL.gif

    Below is a video with more tests showing how the version of Unity and the physics solver type affects the outcome. Switching the physics solver to Temporal Gauss Seidel doesn't resolve the issue, although it does help a little.

     
    Last edited: Mar 18, 2024
  9. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,529
    You can, but expecting physically realistic reactions typically requires increasing the physics rate, substeps, etc. I'm surprised they didn't mention this point to you.

    For example, a joint attaching two Rigidbodies with a mass ratio of 10:1 is perfectly stable by just increasing the physics rate from 50 to 100 Hz.

    What I'm even more surprised is that the first case is not considered a bug. The upgrade to PhysX 4.1.2 is breaking a number of previously working situations, but unfortunately that's what Nvidia considers the "correct behavior" now.
     
    Trigve and Barritico like this.
  10. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    Thanks for your insight :D

    I think the old simulation was more appropriate for games, as the errors were easy to ignore (objects passing through each other), while the new simulation's eventual outcome is more accurate, the errors it exhibits along the way are jarring and in our case game-breaking. We could increase the simulation settings to improve the issue in our game but that'll destroy our performance as we're developing a relatively physics heavy mobile game.

    I guess what I find most frustrating about this situation is that this change was done in a patch release for an LTS version of Unity o_O
     
    stonstad and Edy like this.
  11. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    131
    I've done further testing...

    In the above video, I didn't realize the sphere rigidbody had the Collision Mode set to Continuous Dynamic while the cube rigidbody was set to Continuous. I have since discovered that using Continuous Dynamic is what is causing the stutter. Even when the mass ratios are less than 10:1 there is still a visible stutter if any of the colliding rigidbodies are set to use Continuous Dynamic collision detection and the relative velocity of those rigidbodies is high enough.

    SOLUTION - Don't use Continuous Dynamic collision detection.
     
    stonstad, Edy and Trigve like this.
  12. RisingScope75

    RisingScope75

    Joined:
    Jan 5, 2023
    Posts:
    38
    this issue persit on "plane object" , using 2022.2.1.11f .. I desactivae Use continues collsion.
     

    Attached Files: