Trigger character ragdoll with input key event?

Hello,

You will want to drag off a get reference to your mesh and then use a “Set Simulate Physics” node set to true.

In this example, I am in a player controller, casting to my character, so that when I press ‘F’ the character’s Skeletal Mesh will enter a “ragdoll” state. I hope this helps!

Cheers!

It’s sensitive to what is being dragged off of. You should click-drag off of the Cast To’s “As Character” then search for “Get Mesh”. Let me know if that helps!

I so far haven’t been able to trigger ragdoll on the character, or on placed skeletal meshes. I’m using the third person character template.

Edit: I figured it out eventually, the example character doesn’t have a physics asset. Luckily, it’s not hard to add one:

  1. Go to the Blurprints folder in the Content Browser and double click the MyCharacter blueprint.

  2. Click the Components tab in the top right. Then on the left select the character mesh: Mesh____HeroTPP

  3. Scroll through the Details panel until you find Collision/Collision Presets and change it from CharacterMesh to Ragdoll.

  4. Go to the Character folder in the Content Browser and Right click/Open in Full Editor on HeroTPP:

3961-ragdoll+1.jpg

  1. Open up the level blueprint and make a blueprint like this:

  1. Right click and search for the nodes, if you can’t find any of them, uncheck the context sensitive filter. ‘Target Mesh’ is created when you wire Get Player Character to Set Simulate Physics. Make sure you check the Simulate box in Set Simulate Physics.

Thanks, !

I can’t seem to get the right “Target Mesh” reference, just a regular Mesh variable. The context sensitive filter doesn’t pick it up.

I’m in the graph editor for the character blueprint, is that the right place?

It just creates that same mesh node, but unlinked from Cast To Character.

Oh, I didn’t notice that you were already in the Character. You do not need to cast, just do Inputkey F straight into Set Simulate Physics. The way I thought you were doing it was by using the Controller Blueprint, but if you are having it done directly from the character, then you do not have to cast to it.

That causes the character to freeze in place. When I toggle Set Simulate Physics off, it goes back to normal.

I think the example character in the for Third Person Blueprint doesn’t have a physics asset. I tried grabbing one from Example Content and placing it in my map to see what would happen. It just flickers and doesn’t collapse. Most difficult.

i set the skeletal meshes collision preset to ragdoll, and then used the mesh in blueprints to call SetAllBodiesSimulatePhyics… then it worked

Still no dice. You got this to work with the example character? Doesn’t seem to do anything. I changed the Collision Presets to Ragdoll in Components for the MyCharacter Blueprint:

I tried both Set Simulate Physics and Set All Bodies Simulate Physics. I mash the F key and nothing happens.

3451-04.jpg

I also tried Wake Rigid Body and Wake All Rigid Bodies, no affect.

I came across this because I’m making a skateboarding game and want to trigger my character to ragdoll if an animation doesn’t finish.

I managed to get the above (top) method working (triggering ragdoll via key presses). But I am unsure how to make this work in my context. I tried creating a boolean variable called “Bail” which I planned to set to to true inside my Animation Blueprint (when ‘IsInAir’ was false + trick animation not finished).

My first issue is that I cannot hook up a ‘get’ boolean variable into the “Set Simulate Physics” Node. It’ll accept ‘setter’ versions but this isn’t going to help me as I need it to ask (get) the value from the animation state machine. Maybe I’m thinking about this wrong? (I’m new to scripting/kismet/Blueprints etc).

Thanks

I’m trying to do the same thing, although not for a skateboarding game.

You need 2 variables, one for when the character is in the air (which already exists) and one for when the animation is playing. Then when both are true, trigger the ragdoll. In logic/flow control this is called an ‘AND gate’. You can do it with Branch nodes:

I created a new boolean variable called ‘Animation Playing’ (you can call it whatever). Then dragged it onto the graph and created a ‘Set variable’ for True and another ‘Set variable’ for False. I used a Delay function between them for the length of the animation.

Then I made a Branch node for the ‘Is in Air’ and ‘Animation Playing’ variables.

This isn’t a complete blueprint because I actually don’t know how to trigger an animation or ragdoll in the AnimBlueprint. It’s different from the Level and Class Blueprints. If you know how to do those parts, that could help.

That’s a great help Snow thanks! :slight_smile:

I’m having some success. I can now trigger the ragdoll from within the Anim Blueprint but by using the methods above (also in my screengrab). What’s happening here is that I discovered the ‘AnimNotify_jumpNotify’ node and am using that to trigger the AnimIsPlaying node. This is only a temporary hack since my Olli animation triggers at the same point as the jumpNotify.

I think I told you to hook it up wrong, the ‘Is in Air’ Branch node should be using the False output leading into the next node. That way the ragdoll will trigger when you hit the ground, if animation still is playing.

You can also make the character’s physics capsule ragdoll. Since that’s what the camera is attached to, it makes the whole thing seem more natural.

Open the character blueprint. In the Components tab, select the ‘[ROOT] CapsuleComponent’ and change its Collision Presets to Ragdoll. Under Rendering, you can also uncheck ‘Hidden in Game’ to see it happen.

Then in the blueprint, drag a wire off Get Player Character and search ‘Get Capsule Component’. You can take control away from the player too with Set Ignore Move Input:

I still can’t get get the character to go back to normal after the ragdoll, or set up a physics asset that isn’t completely ridiculous. But it’s getting there.

Did you make progress Snow? Surely respawning will reset the ragdoll no? I haven’t had a to get this working properly yet (got sidetracked getting a scoring/pickup system working & working on art assets). I did have a quick look at my logic and realised it wont work properly for Olli anims.

IF BAIL condition (inAir==false & animplaying== true) then this could mean that as soon as the skater hits the jump/Olli button he’ll bail because he’s on the ground playing an animation (at least for the first few frames). I think I probably need a AnimJump Event with an Animation Tag in the Anim BP which triggers a message at a certain frame of the Olli anim.

I cant find Set Simulate Physics node.
PS i am not snow

nvrmnd i found it

I’m not doin this anymore

care to share?

I found this question while looking into how to do this, and though it is older I thought I would share what I came up with:

I have two functions on my character’s blueprint, StartRagdoll and StopRagdoll.

StartRagdoll takes a reference to the character mesh and sets its collision profile to ‘Ragdoll’ and then sets Simulate Physics to true.

StopRagdoll does the same in reverse, but then it reattaches the mesh to the capsule component and sets it relative location and rotation to the same values that the mesh started with.

1 Like