Physics performance regression in Unity 2022.3.8 and onwards

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.

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

2 Likes

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.

1 Like

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.

Same in 2023.3.14f1

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

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.

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.

4 Likes

Issue Tracker Link - Unity has marked this issue as Won’t Fix :eyes:

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?

9675257--1378763--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.

6 Likes

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.

2 Likes

Thanks for your insight :smile:

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 :eyes:

4 Likes

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.

6 Likes

this issue persit on “plane object” , using 2022.2.1.11f … I desactivae Use continues collsion.

Hi there!
I’m stuck on Unity LTS 2021.3.29 because the next version had this physics “fix”, my game is pretty heavily based on physics and I don’t want to mess it up.
Did avoiding Continuous Dynamic detection or increasing the physics step completely fix the issue for you in the end?

Avoiding Continuous Dynamic detection completely resolved this issue for us.

2 Likes

Time to update then! Thanks! :+1:

Please make sure to profile your game thoroughly. In my experience, and after extensive profiling, Unity 6 Physics is noticeably slower compared to version 2022.3.5X. It’s surprising that this issue hasn’t been widely discussed.

In our case, after spending over a month upgrading everything in our late-production game to take advantage of the new features, we discovered this performance drop, which was quite disappointing. We’ll be waiting to see if Unity improves this in future updates.

We just updated to Unity 6 and haven’t noticed any physics performance regression, we haven’t profiled though.

If there is a provable regression you should at least start a new thread to bring it to people’s attention and if possible, submit a bug report.