Newbie question about collisions and ragdoll

I’m new to Unreal 5.3 coming from Unity. I’m using the third person template and am experimenting with rag-dolls and OnComponent Hit events. I want to be able to have the player rag-doll when they hit the floor. I replaced the original floor in the level with a blueprint cube that has an OnComponentHit that references a custom event on the BP_ThirdpersonCharacter blueprint that causes the player to rag-doll. When I run the game and jump then hit the floor the player rag-dolls as expected. The problem is that the player rag-dolls when it comes into contact with anything solid like the walls which have no blueprints attached to them. Any help would be appreciated.

Hey there @Nitrox32! Welcome to the community! So after the OnComponentHit you’re going to need to check what it’s colliding with then only apply the ragdoll if it was the player. This is one way that compares the class, so that any third person character can trigger it.

1 Like

OK, that makes sense but I’m getting an error.

The behavior you described suggests that the player is ragdolling due to an OnComponentHit event that gets triggered not just by the floor but by any collision with a solid object.

Here’s a step-by-step guide to achieve the desired behavior:

  1. Make sure your player’s collision is set up correctly:
  • Your player’s CapsuleComponent should be set to block all by default.
  • The mesh (assuming it’s a skeletal mesh) should be set to No Collision by default.
  • When you switch to ragdoll, you’ll enable collision on the mesh and disable it on the CapsuleComponent.
  1. Set up your floor Blueprint correctly:
  • Make sure that the OnComponentHit event on the floor Blueprint specifically checks if the actor it collided with is the player. You can do this by using the “Cast To” node in Blueprints.
  1. In the BP_ThirdPersonCharacter:
  • Make a custom event or function that switches the character to ragdoll. This event/function should:
    • Disable collision and physics simulation on the CapsuleComponent.
    • Enable collision and physics simulation on the character’s skeletal mesh.
    • Optionally set all the physical animation weights to 0 to fully ragdoll the character.
  • Call this event/function only when the specific condition is met (e.g., the character hits the floor).
  1. In your floor Blueprint:
  • On the OnComponentHit event:
    • Use “Cast To BP_ThirdPersonCharacter” on the hit actor. If the cast is successful, it means the player character collided with the floor.
    • Call the ragdoll custom event/function on the BP_ThirdPersonCharacter.
  1. To avoid the character from ragdolling when hitting walls or other objects:
  • Ensure that the OnComponentHit event in your floor Blueprint is the only one triggering the ragdolling. Other objects in your scene should not inadvertently call the ragdoll event.

Remember, if you’re using a OnComponentHit event, it can be triggered by any hit unless you specify a particular actor or object. So, always double-check which actor or component triggers the event and under which conditions.

Lastly, consider the order of operations. If you’re checking for a collision in both the player and the floor, there could be conflicting behaviors. Try to centralize the logic, either handle the collision entirely in the character blueprint or entirely in the floor blueprint, to avoid unexpected outcomes

1 Like

Ok, I’ll give it a try.

Yes Let me know

I checked if the player’s collision is set up properly an it is. This is what I wrote on the floor blueprint and no matter what I run into the print string fires. I guess I simply trying to get the logic correct before I tackle the rag-doll. There are no collision blueprints on any of the walls or any other objects in the scene.

I just tried it in a new project and the blueprint above works. Ill let you know how the rest goes.

1 Like

I’m almost there. I was able to get everything working according to your description above. The rag-doll still occurs when running into other objects but I now I can more specifically describe the behavior. So:

  1. When I run on the floor - no collision
  2. When I jump on the floor or fall from a grey object to the floor - collision
  3. When I run into an object while on a grey object - no collision.

It seems that while I am on the floor it seemed the OnHitComponent in the floor blueprint is being transferred to my player somehow.



I guess I should be more specific about what I am trying to do. I just want to create a situation where if I fall off the wall my player dies. So I guess since it accomplishes what I want to do I shouldn’t be concerned, but since I’m learning I’m just looking understand the behavior.

best post ever on ragdolls, straight and to the point. thank you.