Weird Ragdolls

Cheo

Active member
Hello, this is a big issue I've been meaning to talk about for a long time. UCC3's Ragdolls are just plain weird and bad. Even in the demo scene, they're slow and jittery, and even a bit disjointed in Atlas' case. I'm not the only one who's bothered by this, but I thought it was time to bring the subject on the table. Here is a quick video about it :


As I say in the video, we are now in 2024, there is simply no excuse for having such weird ragdolls when games from the 2000's like Half-Life 2 had much cleaner body physics. Here is one example from my own project Purple Eye, you can clearly see some slow and jittery physics on dead enemies the moment the Ragdoll ability is activated.


This is annoying and embarrassing, and feels like a stain on a mechanic I'm otherwise pretty satisfied with. I know that there are other issues I've already qualified as major and needing to be among the top priorities, but I'm afraid this one must join the list. I hope it can adressed, and if anybody has an idea about this, I'd be grateful to hear it. Thanks.
 
This is using Unity's standard ragdoll system with no character controller code. When setting up Atlas I followed a video for "good" ragdoll settings but even then it's iffy. PuppetMaster does a much better job at ragdolls. If you find some good values for your game I'd love to hear it so I can then use the same for Atlas.
 
After doing some experiments, I concluded that the root of the issue was the Interpolate RigidbdodyInterpolation mode. If None or Extrapolate is applied, then we no longer see the character falling in a slow and jittery way. Here's a new video demonstrating that :


And here are the bits of codes we could add to the Ragdoll ability - first add this at the top :

C#:
        [SerializeField] protected bool m_ChangeCollisionDetectionMode = true;
        public bool ChangeCollisionDetectionMode { get { return m_ChangeCollisionDetectionMode; } set { m_ChangeCollisionDetectionMode = value; } }

        [SerializeField] protected CollisionDetectionMode m_RagdollCollisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
        public CollisionDetectionMode RagdollCollisionDetectionMode { get { return m_RagdollCollisionDetectionMode; } set { m_RagdollCollisionDetectionMode = value; } }

        [SerializeField] protected bool m_ChangeRigidbodyInterpolation = true;
        public bool ChangeRigidbodyInterpolation { get { return m_ChangeRigidbodyInterpolation; } set { m_ChangeRigidbodyInterpolation = value; } }

        [SerializeField] protected RigidbodyInterpolation m_RagdollInterpolationMode = RigidbodyInterpolation.None;
        public RigidbodyInterpolation RagdollInterpolationMode { get { return m_RagdollInterpolationMode; } set { m_RagdollInterpolationMode = value; } }

And this in Enable Ragdoll :

C#:
            // Add the ragdoll force.
            for (int i = 0; i < m_Rigidbodies.Length; ++i)
            {
                m_Rigidbodies[i].useGravity = m_CharacterLocomotion.UseGravity;

                if (ChangeCollisionDetectionMode)
                {
                    m_Rigidbodies[i].collisionDetectionMode = enable ? m_RagdollCollisionDetectionMode : CollisionDetectionMode.Discrete;
                }

                m_Rigidbodies[i].isKinematic = !enable;
                m_Rigidbodies[i].constraints = (enable ? RigidbodyConstraints.None : RigidbodyConstraints.FreezeAll);

                if (ChangeRigidbodyInterpolation)
                {
                    m_Rigidbodies[i].interpolation = (enable ? m_RagdollInterpolationMode : RigidbodyInterpolation.None);
                }

                m_RigidbodyGameObjects[i].layer = enable ? m_RagdollLayer : m_InactiveRagdollLayer;
                if (enable && force.sqrMagnitude > 0)
                {
                    m_Rigidbodies[i].AddForceAtPosition(force, position, ForceMode.Force);
                }
            }

As I say in the video I'm no expert in programming nor physics, I don't know what the best setting combination is nor why Interpolate works correctly on characters not using UCC, but it's pretty safe to say that until we can answer the latter question making None the default option is the reasonable thing to do. Hope you can make this change for the next update so that we can get decent ragdolls out of the box, thanks.
 
Top