I’ve worked on a physics-driven ragdoll-like player character controller for a few months now, and have read just about everything on Unity/Physx joints I could find, and now I have a pretty stable character built with only configurable joints, most configured with “Enable collision” turned off, to make the colliders not affect his movement.
Whenever I make him carry objects (rigidbodies) in his hands, the joint (with “Enable collision” set to false) between his hand and the object he carries, will jitter seemingly at random. Sometimes it works fine for 30 seconds straight, but suddenly it starts jittering, even when there is no movement in either object.
The solution to my jittering hand-to-object-joint: Turn off the hand collider while the hand and the object are connected with the joint. It also works if I turn off the colliders on the object, with which his hands are able to collide.
The jittering is completely gone! Butter smooth now. WTH? They should not be colliding with “Enable collision” turned off, and they don’t look like they’re colliding. It looks more like the connected anchor rapidly shifts back and forth between two different positions, which in turn affects the hand. But looking at the values on the joint, they’re all stable while this is happening.
Here’s the full joint setup between the two objects. Any collapsed settings are left at default.
I’ve tried to do a repro project, to file a bug report, but I can’t make it jitter with simple setups. I have a full ragdoll, with loads of scripts for moving the hands, but I’ve painstakingly spent hours toggling all parts of my controller off and on in different configurations, to see if they had an effect on the jittering, but no. Only disabling one of the colliders, which should not be colliding anyway, removes the jittering.
P.S.
I hate these soft joints so much…why don’t we have the choice of “hard” joints? You cannot build a mechanical object in Unity, with which players can interact, without it swinging out of its limits all the time.
UPDATE:
The colliders ARE the problem! Even with “Enable collision” set to false, when connecting the anchors and connectedBody, it still considers the colliders. When placing the object, say a weapon, in the hand of my player, if I do not turn off all the colliders on the hand, the weapon SOMETIMES gets pushed out of the colliders, and sits outside his hand. If I turn off all the colliders before setting the anchors, it always gets positioned correctly.
Because of the first problem, with the jittering, I cannot reenable the hand colliders until the player lets go of the object.
Everything is working fine now…except for the “Enable collision” flag on joints