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?
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.
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.
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.
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.
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.
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.
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.
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:
Start a new Unity 6 project.
Add a Cube to the scene (3D Object ā Cube)
Remove the Box Collider from the cube (not sure that actually matters.)
Add a MeshCollider to the Cube. Be sure not to check Convex.
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?
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.