Unreal Engine – How to create a Ragdoll Effect For first Person Death or Knock down
Please note it’s not possible to ragdoll a first person character that has no skeleton. There is no where to apply the physics and in Unreal engine you can’t apply ragdoll physics simulations (as far as I know) to the capsule component that manages the first person physics collisions. Whilst you could just apply physics to a first person character arms, this probably isn’t the effect you are looking for, as the arms will just roll about!
The solution below does require some knowledge of blueprint, but if you have any questions please do ask and leave a comment.
First solution:
1. Switch your model to a 3rd person model and then ragdoll this model. To do this you would use a ‘true first person’ approach, so the first person view would be maintained. You could also zoom out the camera or switch to another camera when the ragdoll is applied – to watch the ragdoll effect in motion.
Second solution:
The above was not an option for me as I didn’t have a full character mesh and had no plans of using one. So I came up with the solution below, which is fairly simple to implement and I am happy with the result. Although please do see the caveats below in relation to this approach.
Setting up a new camera and static mesh:
- In the First person charcter blueprint.
- Add a static mesh – I found a pyramid shape works well, but different shapes provide different types of rolling, falling over etc…
- Scale and position this static mesh as required.
- Add a 2nd camera.
- In 2nd Camera make sure that Use Pawn Control Rotation is ticked on.
- Not ticking Use Pawn Control Rotation caused me some collision issues on stairs when looking up!
- Position the 2nd camera in exactly the same place as the 1st camera.
- Parent this new Camera to the static mesh (make sure nothing else is parented to this static mesh). See image below.
Activating Physics on the Static Mesh – This will simulate the falling down of the character.
- On the death or knock out event (this will be whatever triggers that event for your character) – trigger physics for the static mesh and switch to the 2nd camera (see image below).
- You must switch between the main camera and the new camera to see the effect.
- See blueprint nodes below: Set cameras active or inactive > Disable input > Set Simulate physics to the static mesh > add impulse if you want (is not required for this to work)
- Then the next event brings the camera and player input back and this is trigged by a custom event. Although you can use a different event or just have a level reset / load last save, etc…
Caveats:
- Set the static mesh, that has the physics applied, to ‘to hidden in game.’ So there is no chance this out of place shape being seen!
- The collision of this static mesh may effect your character walking through entrances, doorways etc… Watch out for collision and shape mesh so it doesn’t effect movement.
- The physics will drop the static mesh to the ground, so it’s position may need to be reset if your character gets up again. I didn’t have to do this in my case as I was using ragdoll as a ‘knock down’ effect and it only happened once in the level. A level restart or starting a new level should reset everything, but I linked a post below that does go into one solution for this if you need to reset the position of the static mesh during level play. Although this may be a bit harder as it needs to be reset inside the character blueprint which is not mentioned in the link below.
- If you are blending between a level sequence cinematic and the character knock out / down – then make sure to switch back to the main camera before the sequence ends and blends back – otherwise it will blend to the wrong camera.
Reset the position of a physcis object: https://forums.unrealengine.com/t/reset-transform-of-all-physics-objects/476595
For further tutorials on Unreal Engine blueprints – please click this link.
Leave A Comment
You must be logged in to post a comment.