After upgrading to Unity 6, I get several physics related errors

First, I cant select Physics subforum because it is not included in the forum selection dropdown.

So back to my problem:
I upgraded my 2022.50f1 project to the newest Unity 6 version.
After some minor changes to make the project run, I get several error messages (all of the same 2 types) right after start that confuses me because in the older version, all this worked pretty well. Both error types are related to the Physixs engine.

First exception:

[Physics.PhysX] computeMassAndInertia: Dynamic actor with illegal collision shapes
UnityEngine.Object:set_hideFlags (UnityEngine.HideFlags)

Second exception:

[Physics.PhysX] PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
UnityEngine.Object:set_hideFlags (UnityEngine.HideFlags)

The thing is I did not change anything related to the colliders or rigidbodies of any object during upgrade. I use simple collider shapes like spheres and boxes and in the rigidbody I set them to ā€œis kinematicā€ because these objects shall collide and not be affected by any force (like gravity).
Rigidbody settings are like:
Mass: 1, Drag: 0, Automatic center of mass: true, Automatic Tensor: true, Use Gravity: false, Is Kinematic: true, Collisiondetection: discrete. Rest is default.

When I uncheck ā€œis kinematicā€ the error disappears, but than the object drifts away what I sure dont want.
So how can I have the old behavior back with kinematic objects and simple shapes like boxes and spheres, or even complex shapes like meshes?

Anything I missed during upgrade? Or is this a known bug?

Any help welcome!

6 Likes

I recommend you creating a very simple scene that reproduces the bug, including only the necessary objects to reproduce it. Then submit a bug repro with it using the bug reporter tool.

Agree with what @edy posted above, report it as a bug with easy steps to reproduce it. Thanks!

As others said please report and we’ll address the issue, I’m quite curious how you’ve gotten in this state.

Cheers,
AlexRvn.

Exact same errors popping up here, and the rigidbody settings are the same as yours. We upgraded from unity 2023.2.9.

Here it seems to be caused by a combination of having a rigidbody with those settings + a concave MeshCollider in its hierarchy (in the same gameobject or in the children). Marking the MeshColliders as convex makes the error go away.

1 Like

Had the same issue after updating to Unity 6.
In my case, deselecting automatic center of mass and tensor solved it.

At least, solved it as in no more errors, still waiting to see if that brings up other issues.

2 Likes

Upgraded the project to Unity 6 and the ragdoll physics and vehicle physics are broken.

This could be due to the Automatic Tensor property or the changes in Rigid body API and therefore all the other physics based joints.

Versions before Unity 6 work perfectly all the way from Unity 2017 to Unity 2023.

2 Likes

The same issue arose after updating from Unity6000.0.13f1 to 6000.0.23f1.

I went straight into 6000.0.26f1 and that solution worked for me.

I DID try 6000.0.23f1, but I was getting a ton of errors after ā€˜updating’ my 2021.3 project which were Unity related but fixed on 0.25f1 I think. Might be worth an upgrade either way.

1 Like

I’ve said this elsewhere I highly recommend against simply upgrading to Unity 6. There’s too many differences.

IMO it’s better to make a new project, move over your assets and configure settings from the defaults.

Even in the beta upgrading was always full of problems and crashes.

2 Likes

Search by intersect{where{p t:MeshCollider, @#m_Convex=ā€œFalseā€}, where{p: t:Rigidbody, @#m_ImplicitCom=ā€œTrueā€ or @#m_ImplicitTensor=ā€œTrueā€}} and find the corresponding of`

Rigidbody’s Automatic Center Of Mass and Automatic Tensor were set to False, and the issue was fixed.

Thank you.

1 Like

I’m trying to get an old project (2016) to rebuild. The error was fixed as suggested by turning off the automatic tensor and automatic centre of mass on the rigidbody attached to the player. Player uses standard assets as its controllers if that helps.

The solution suggested to turn off auto center of mass and tensor for me does not sound like a real fix.
Yes you might dont get any errors anymore, but the main bug is still alive. Because why are there auto values for center of mass and tensor if you can’t use them in 6 when it workes in an older version?

Maye I want to use automatic calculations for these values?

I will wait until this issue is fixed before I upgrade again.

2 Likes

Agreed. Turning Centre of Mass and Auto Tensor off is not a solution. The auto tensor goes to 1,1,1 which is a value that changes dynamically as the object moves or gets heavier (if your game has a dynamic mass where you make things lighter or heavier at run time). This used to work pretty well in all of the other versions. Still broken in 6000.0.25f1. Please revert to the original rigidbody module.

1 Like

Again, that is not quite the solution as the Auto Tensor is fixed to 1,1,1.

I just upgraded a project from 2021.3 to Unity 6, and started seeing this error when I would leave Play Mode after instantiating a physics ragdoll prefab that was created under an older version of Unity.

The cause of the error seems to be because the old rigidbodies made prior to Unity 6 don’t have all of the values that Unity 6 is expecting.

The ā€œfixā€ for this in my case appears to be very simple: Just do something to cause an edit to any of the rigidbodies that are exhibiting this issue, and Unity will automatically serialize the prefab with the correct, contemporary rigidbody settings. In my case, I just selected all the rigidbodies, toggled a checkbox, and toggled in back. No effective change to the rigidbodies, but doing this in the inspector was enough to clean up the rigidbodies and prevent this from occurring again.

But this raises a huge question about upgrading projects: Is there a project-wide action for updating all rigidbodies to be compatible with the current version of the engine? HDRP has something like this for updating Materials to ensure they’re compatible. Is there a physics version of this?

Thank you for sharing this fix. However, this does not quite work for me. As you mentioned, I tried toggling various checkboxes on the rigidbody components in the playmode and editor mode and the abnormal physics errors were still not fixed sadly.

1 Like

I’ve spent a bit more time on this when I found another object that was causing this error to be logged, and it’s absolutely a bug, which is trivial to reproduce. I’m not 100% of all of the reasons this error might be logged, but the simplest way to get this error to log is to add a kinematic rigidbody to an object with a non-convex MeshCollider. For example:

  1. Start a new Unity 6 project.
  2. Add a Cube to the scene (3D Object → Cube)
  3. Remove the Box Collider from the cube (not sure that actually matters.)
  4. Add a MeshCollider to the Cube. Be sure not to check Convex.
  5. Add a Rigidbody to the Cube, and check Kinematic.

The errors will now be logged, and they’ll be logged again any time the object is activated again, or you toggle Kinematic off and on again. I tested this against a few different meshes, and it always occurs.

I also tested this in a build, and it also emits these errors in a build. So, this isn’t just a Unity Editor thing.

I’ve reported this as bug number IN-90767. So far I don’t know of any workaround to prevent this. I also don’t know how severe this is. It’s possible this isn’t a show-stopper, if it’s just occasionally doing a bit of logging. (It’s not logging every frame, so people might be able to cope with a bit of error logging.) But I don’t know if it points to a bigger issue.

I’m not sure if this is exactly what the OP is seeing. @Pascal81, can you confirm if the kinematic rigidbody you’re looking at has a non-convex MeshCollider on it?

1 Like

The issue I submitted was closed as a duplicate of this issue:

It’s apparently fixes in Unity 6.1a8, but a8 isn’t available to test on yet. Hopefully backported to 6.0 soon?

Well I am crazy here, Unity 6 broke all my truck physics, joint attachments. It is so sad.

I am setting those values on Awake, but got no luck:

rb.automaticCenterOfMass = false;
rb.automaticInertiaTensor = false;
rb.inertiaTensor = Vector3.one;

After joining the trailer to the vehicle it flies and jumps… This does not happen in Unity 2020.x/2022.x. Prefabs and scenes with already configured vehicles are also broken once loaded.

Unfortunately separating a project demo will take several days since it is a bit complex with tons of content. But I’ll try my best to provide a reproduction sample.

Unity 6 is considered production ready. This kind of problem sucks. All new versions break something very important. We are forced updating it since Google Play soon or later will require it, and old versions of Unity get abandoned very soon (two years is too little for LTS considering that mobile platforms change all the time). So many hours spent fixing what was working fine. :frowning: