Ragdoll Ability

UncleFesterson

New member
Hi,

I am trying to get my player character to ragdoll correctly when the ability is activated through a behavior tree. The problem I am encountering is my character will actually ragdoll, but it hovers above the ground when doing so as if there was a collider underneath of it preventing it from touching the ground. The ragdoll upon dying works fine and the player falls on the ground - it’s only when the player hasn’t actually died, but has the ragdoll ability activated. I’ve tried messing around with the active/inactive layers using Character and Subcharacter layers too but no luck so far.
 
Is the main capsule collider still active? Have you tried disabling that collider?
 
You don't need to kill the player, but executing OnDeath is required I believe. Also cancel respawn.
Here is a piece of code I used for the motorbike controller in USC that should give you the right idea.

C#:
 for (int i = 0; i < m_RiderLocomotions.Count; i++)
                    {
                      
                        Board board = m_RiderLocomotions[i].GetAbility<Board>();
                        Ragdoll ragDollAbility = m_RiderLocomotions[i].GetAbility<Ragdoll>();
                        UltimateCharacterLocomotion locomotion = m_RiderLocomotions[i];
                        Respawner respawner = locomotion.GameObject.GetCachedComponent<Respawner>();

                        bool originalScheduleRespawnOnDeath = respawner.ScheduleRespawnOnDeath;
                        respawner.ScheduleRespawnOnDeath = false;
                        EventHandler.ExecuteEvent<Vector3, Vector3, GameObject>(locomotion.GameObject, "OnDeath", locomotion.transform.position + -locomotion.GravityDirection * board.OffsetY, m_ApplyCrashForces ? m_RigidBody.velocity + (Vector3.up * 15f) : Vector3.zero, null);
                        respawner.ScheduleRespawnOnDeath = originalScheduleRespawnOnDeath;

                        SchedulerBase.Schedule(m_RagdollDuration, () => { locomotion.TryStopAbility(ragDollAbility, true); EventHandler.ExecuteEvent(locomotion.GameObject, "OnRespawn"); });

                        m_RiderLocomotions.Remove(m_RiderLocomotions[i]);
                    }
 
Top