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!
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!
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.
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.
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 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).
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.
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.
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.