IN-34662 physx joint baking broken

I only just noticed this but I’m getting wildly different results from joint conversion seemingly post 0.6.x with 0.50.p43.

The culprit seems to be my character/configurable joints dont appear to have any limits after converted, Ive added some gifs to illustrate this. Prior to 0.50, I was getting what I’d assume were correct results from conversion, but now it appears wildly different.

same character

physx - character keels over due to limits as expected

after conversion unity/havok physics - character kind of just deflates like a sad balloon.

and just another extended result

incompatiblerareiberianbarbel

1 Like

replacement code

Sort of fixed it mealyconventionalbluemorphobutterfly

Had saved some old joint conversion code way back when joints were introduced in the package, which I copied and used for manual entity joint setup.
Replaced the code inside the current “CreateConfigurableJoint” in LegacyJointConversionSystem.cs, and it appears to more or less convert properly.

2 Likes

Still seems to be the case with latest physics - physics 1.0.0pre44

showyalarmingacaciarat
red is dots, and green is physx: they have the exact same physx settings.

personaladorableatlanticblackgoby

reported as IN-34662. going by the thread date, am i seriously the only person using this? its been broken for almost a year?

Are you creating the ragdolls with the legacy physix joints?

I noticed that not all things are properly mapped from the legacy joint editor component to the unity physics equivalent.

But creating ragdolls from script seems to work.

Their Ragdoll sample scene here:
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/PhysicsSamples/Assets/Demos/4.%20Joints

Was broken for a while when they moved to the new transform system, but seems to be working now again.

They don’t use the editor at all and just create those joints from code.

Have you tried with both their new physics joints authoring components from the sample project and the legacy ones?

Do you observe the same if you use the authoring components from the samples?

1 Like

I’m not using the samples(think we went over this in discord) joint authoring as they aren’t official. If later down the line some ui update breaks the inspector or whatever for those authoring component samples and unity decides never to bother to update it, its one less thing I would rather not have to fix on my own.
Trust me I’ve done the whole shebang of ragdolls from code, but Unity added real actual joint conversion way back before 0.17, but it broke somewhere after that and now its been broken for some time. The dots blitz day mentioned that the idea was to use the physx components as the proper way to author / and some rearchitecture was in the works ( https://discussions.unity.com/t/902468 ).
If there weren’t any joint conversion code aside from the samples this might have more merit, but unity provides builtin stuff that has been broken for quite a while.

Even in the post here suggests to use builtin physx stuff as an alternative - https://discussions.unity.com/t/912395 this person will eventually experience the same result.

If unity doesn’t actually plan to support this workflow of physx joints to dots, it should just be removed outright.

The code I posted here still works as a fix(obviously you will have to rework it a bit to conform with the new bakers) and passes the eye test but as for being an actual correct result I’m not sure as I’m pretty far from being knowledgeable on how joints work.

2 Likes

@thelebaron : We recently confirmed (see other thread here ) that there is a discrepancy in the Character Joint and Configurable Joint behavior when baking them to Unity Physics compared to the built-in physics simulation.

The issue occurs notably with the default stiffness and damping parameters (both zero), in which case Unity Physics physically correctly models the limit with “zero resistance force”, whereas the built-in physics simulates in this case a “default stiff” limit behavior.

I saw that in your replacement code you are simply using “always stiff” parameters within the baker, which would explain why the replacement code fixes the issue for the default parameterization.
We are tracking this problem internally and are working on a solution.