We recently updated from 2021 LTS to 2022 LTS (specifically 2021.3.6 → 2022.3.10). Something between the 2 versions has changed and now all configurable joints used for VR grabbing behave/feel different… It feels like all joints are ‘weaker’. Does anyone know if anything in the engine has changed that would effect this? Potentially something with the new physics simulation/timing setting?
The project is fairly large and unruly so it has been hard for us to pin point an exact issue. We have also not had time to update a backup project 1 version at a time to find which version exactly breaks/changes everything but we will be doing that this week.
I realize the question is pretty vague and without and any specifics is difficult to answer, just wondering if anyone has experience with this?
After testing on multiple versions of the editor we have determined that the issue is caused by modifying the inertia tensor of a rigidbody (maybe not working in 2022+?).
I have created a test project that shoots a gun and measures the max bullet spread when impacting a wall. As you can see from the screen shot, when running identical projects in different versions of the editor we get very different spread. If I remove the script that changes the inertia tensor, everything goes back to roughly the same (spread force is random so will never be identical).
[mod edit: do not post or share code from assets publicly]
This issue affects all versions of 2022 (tried on 2022.1.0+). I have attached 2 sample projects for testing (2021.3.31 & 2022.3.10). Is this a bug or should I be changing the inertia tensor differently?
I’d try reducing the test project to a single case that shows the divergence consistently each time. For example, log the data of the bullets and the exact spread applied (the values applied to that impact), and take a single bullet that produces a huge spread on 2022. Applying the same data in 2021 should get the expected result. It should be reproducible every time. You may then try if modifying inertia differently could bring the expected result. Otherwise, you could file a bug with it.
I’ve seen that your RigidbodyOverride script modifies the rigidbody properties one visual frame after it’s enabled the first time (it won’t re-apply the settings if it’s disabled and re-enabled, see the actual order of execution of Unity’s event methods here ). This might be inconsistent physics-wise: once the script is enabled for the first time, quite a few frames (= Update cycles) may happen before the next physics update takes place. Only if, by mere coincidence, the corresponding physics update happens right after the script is enabled, then the overrides would be applied right after that physics update.
This inconsistency might or might not be related with your issue. But if you’re instancing stuff in runtime using these scripts, adjustments in the visual vs. fixed update cycles between Unity versions could be related to the issue. In one case, the new settings could be applied before resolving the forces or impulses in the rigidbody (= override values applied), and in the other case the settings would be applied after that (= override values ignored).
Just a quick update. I replied to your post approx. 2 weeks ago and for some reason the post got deleted. I submitted a bug to Unity and it has been confirmed as “Rigidbody component’s values do not translate to the PhysX calculations when they are being overridden via a script” with bug ID UUM-55081.
Hi,
I’ve been interested in moving from 2021 to 2022, but am now worried:)
Did the Unity folks explain exactly what was going on, so I can know if it’s likely to be a problem for my game?
Is it entirely just that setting the inertia tensor from a script doesn’t work anymore (that’s certainly going to cause a problem)? If so, is there a workaround (and is inertia tensor the only thing that’s not working); if not, what’s the issue?
They didn’t really tell me too much. So far in our testing the only thing we have found is this inertia tensor issue. In 2022 they exposed some new Rigidbody fields (Center of Mass and Inertia Tensor). In our experience setting the tensor from a script or from the new field doesn’t make a difference, they both behave differently than 2021. I have not found a work around yet. I have contacted Unity for more info and will update if I get a response.
This issue looks pretty serious. My vehicle physics packages rely on setting the center of mass and the intertia tensor of the rigidbody from scripting in order to configure the handling of vehicles properly. I’m on Unity 2021, but as for this, I should recommend my clients to stay at 2021 until this gets fixed.
Maybe @MelvMay could bring some insights about if/how is this being addressed internally? I know you’re a physics 2D developer, but I don’t know who is currently in charge of 3D physics (is @yant still around?).
@yant is still around yes and working on 3D physics. I can look at source and answer specific questions but honestly I know nothing about the change history above, sorry.
EDIT: I’ll ping him to see if he can offer insight here; looks like he’s away at the moment though.
Looks like as of yesterday the case from 31st Oct (above) was bisected with initial findings pointing to an SDK update and is being investigated but that’s provisional at best.
Hi,
Is there any more information available about this?
I’m using Edy’s vehicle physics stuff which sets the center of mass and the intertia tensor of the rigidbody from scripting in order to configure the handling of vehicles properly.
Does setting them just not work at all in 2022.3+?
Or is it some weird edge-case?
Is there some workaround?
I’m interested in moving from 2021.3 to 2022.3 (nicer physics debug visualisation), but don’t want to recommend it if inertia tensor isn’t working.
Looking at the case, it’s been set to highest priority and was actively being looked at yesterday trying to bisect the issue AFAIK (from internal comments on the case).
Just the messenger here though, that’s all I know.
Hey @MelvMay , just wondering if you could provide a status update? I noticed the bug has been identified as a known issue in both the 2022.3.13 and 2022.3.14 release notes which seems promising.
The only reason I am asking is because we are approaching the end of our development cycle and would like the begin beta testing with users at the start of 2024. We would really like to use Unity version 2022 for it’s foveated rendering capabilities on PSVR2 but this inertia tensor bug makes it impossible as it greatly effects interacting with objects in game. Also, is it possible to test versions of the editor before it is released in the event that the bug does get resolved?
All I can say is that I can see it being actively worked on, various bisections and rabbit holes trying to find the exact cause.
All I can do is look at the comments on the case and get a general sense of it being worked on. I fear getting pulled into knowing about this case when I absolutely don’t.
I’d suggest asking via the incident you reported for more updates.
Hey folks, I’ve been notified about this case indeed.
Looking into this as a priority and I’m really sorry it’s causing issues for your project.
It’s the very first report of this kind in 2022. From the brief looks I had so far it indeed appears that the behaviour difference came with the PhysX 4.1.2 update. I’m surprised to learn about it, as it’s been out for a while.