Joints in Unity 5 are very unstable - and it's not just me!

We’ve recently upgraded our project to Unity 5. However, we’re running into problems with the new Joints that came with the new version of PhysX.

In Unity 4.6, we could attach a chain of rigidbodies to a ragdoll, and then drag the ragdoll over obstacles like rocks, stairs, etc. Even if we managed to get the ragdoll stuck in an area where it couldn’t fit through the simulation would remain very stable even as we continued to pull on the chain. If, somehow, the ragdoll or the chain started to jitter around because you were pulling on the chain too hard, as soon as you stopped pulling on the chain it would become stable again.

However, in 5, the exact same setup causes the joints to freak out very easily. Once the freakout starts, it never subsides, even after the force that introduced it is taken away. In other words, once it starts, it never stops.

To combat this, we’ve increased the inertia tensors to something much higher than what it gets set to by default. This fixes it in most cases, but then objects don’t behave realistically at all - the rope was stiff and seemed as though it could not be rotated - the ragdoll looked as though it were being held up by some ghost force.
But even with these measures in place, it was still very easy to drag the ragdoll through something that’d cause it to explode forever. These are all situations that Unity 4.6’s PhysX version could handle very easily, and with almost no instability.

The next thing we thought of doing was decreasing the maximum angular velocity of all of the rigidbodies involved… but… why exactly are we needing to butcher the physics so much in the first place, just to get it working?

What exactly changed, and how do we fix this?

3 Likes

Confirmed - yes, they are very unstable by comparison.

UPDATE: I’ve created a simple test that is identical between Unity 4 and Unity 5, (while still following the upgrade guide), and Unity 5’s PhysX joints… well, frankly, they’re abysmal.

It’s almost as though someone screwed up on the math, and it’s applying twice the amount of torque to correct joints, causing them to flicker back and forth across their goal mark.

I’ll upload the comparison demos shortly.

1 Like

Here are the demos: https://dl.dropboxusercontent.com/u/38666531/Physics%20Demos.zip

1 Like

Here is how the test is set up:

  • A chain of rigidbodies held together by configurable joints.
  • The configurable joints do not use spring or damping - their positions X, Y and Z, are set to Locked. No other limitations or drives are given.
  • The rigidbodies’ masses alternate between 1 unit mass and 0.01 unit mass along the length of the chain.
  • The first and last rigidbodies are kinematic, and move back and forth through the Rigidbody.MovePosition() method via script.
  • No projection is used in either demo.
  • Enable Preprocessing is disabled on the Unity 5 demo.
  • The Unity 4.6 demo uses 15 iterations (though it behaves comparably at 6).
  • The Unity 5 demo uses 6 iterations (it behaves significantly worse at 15).

(The differences in iteration count were actually a mistake. I will quickly upload a new version of the demos where the iteration count is 6 on both, just to be fair.)

Fun fact: In all test configurations, Unity 4.6’s physics consumed less frame time (hovering around 0.1 - 0.15 ms) than Unity 5’s physics (hovering around 0.2 to 0.225 ms). (This was determined in the editor however.)

https://dl.dropboxusercontent.com/u/38666531/Physics%20Demos%206%20Iter.zip

Here are the new demos. They both use 6 solver iterations.

I’ve submitted a bug report for this, which can be tracked here: http://fogbugz.unity3d.com/default.asp?689954_upr6627iri6lgof1

I can confirm this. I’ve been working with PhysX several years and have never encountered anything like this. Ragdoll with joints are useless right now. Even when using ODE I never saw problems like this. I do hope this gets fixed, but in the mean time I’m going to use another physics engine, like Bepuik (http://www.bepuphysics.com/).

many things in Unity 5 are buggy as hell =( Continue with 4.6 or wait until bugs are fixed. Thats your only option for now

No, it’s just the ranges are different in Physx 3.x. Basically, in 2.x they were clamped over a certain amount. In 3.x they’re unclamped and have different ranges. In short you need to redo any joints work and learn the new best settings.

If you can prove your scenarios exhibit buggy behaviour with brand new joint settings please file a bug.

1 Like

Have you tried using CharacterJoint instead of ConfigurableJoint?

That’s exactly what I did.

But what are the best settings ? I’ve tried everything I can think of.

1 Like

I’m embarrassed to say this…but reason why the joints were so unstable was because of a bug in my own code :sweat_smile: you can disregard my post.

Heh, Unity followed up on the bug report. I’m happy they got to this bug as quickly as they did. :slight_smile:

Does this means there’s a new version for download ?

No, not exatly - it just means that they are interested in this bug, and want to look into it.

1 Like

So, I’ve had some conversation with Unity QA and they acknowledge that the current state of the Joints in Unity 5 are “not close to optimal” and that the current issues with joints are very visible in games made with Unity. Thankfully though, they are slowly heading in the right direction. No ETA is possible though, understandably.

1 Like

Thanks a lot for this post, Zergling103. And the Unity team for taking over of the problem and try to fix it.

Any new information on this problem?

Thats interesting, especially since physx3.3 supposed to be faster and more stable in general.

Anything new on this? Our ragdolls have had strange behaviours

1 Like