Greetings,
Here is a partial ragdoll hit system I made for one of my games, and I am posting it for free use in any unreal engine 4 project. Its first version so its not perfect but its pretty darn cool. Also, I made the flow a little heavier than it needed to be in the bp to use no macros, less variables and to keep it all inside the third person blueprint for easier implementation into your own games. I hope you enjoy.
-Third person bp (whole thing is in there aside from physics asset)
-Partial ragdoll on hit events
-full ragdoll on certain overlaps (see next)
-Calculates force using newtons 2nd law.
-Distributes force sinusoidally based on angle. (ie. direct hits feel more force, and glancing overlaps won’t necessarily ragdoll you unless enough force is generated)
-Works with any overlap event for full ragdolls, and works with any hit event for partial ragdolls (and possibly full ragdoll based on threshold)
[this is neat because if you slap a weapon with a collision in your players hand and when you swing it (has to get passed both collision capsules so choose object channel appropriately) and it hits the mesh, it will automatically generate the force based on mass and velocity and distribute a percentage of the force between 0 and 1 based on the angle of the hit- cutrrently the angle of the players forward face. Which means in short, you don’t have to do anything to your weapons or bullet other than have them cause a hit event.]
-can be easily plugged into any damage system, or you can base your damage system off of the amount of force for easy implementation without having to code in the weapons (if its simulating physics like a bullet, it will use mass and velocity, if its not it will just use velocity and mass of the player hit, so to change damage amount based on force you would just change the mass and/or the velocity of the projectile or weapon to produce more or less force which you can use to calculate some damage system if you like.)
NOTE: damage system is not built into this, when you see players go down in video its just from a force threshold of what they could take before full ragdoll. Once plugged into a real damage system you could just make it call the ragdoll function upon death or upon serious injury even if the force wasn’t enough to knock em down. I might add a simple damage system based on the force outputs already here and a simple health bar in a later update.
-Simple Landing Event ragdoll as well. (that first step’s a doozy)
-WIP- Working on multiplayer replication, as of now it works somewhat but the ragdolls aren’t replicating properly. I cannot call this multiplayer ready, however its basic functionality seems to work okay. Hopefully in a future update I will iron replication out completely.
If you have any questions or comments feel free to do so and I hope someone gets some use out of this. If you do use it and you like it, I only ask that you might subscribe to our youtube channel or at least give a thumbs up or comment on the associated video. Thanks all!
-MDO
NOTE: Added 4.14 associated project to downloads page. However, nothing has changed and if its in your project already it will have no problems updating to 4.14, it actually runs better in 4.14 from what I saw. Also, I am looking at the new way of doing this at the moment, so maybe a different version of this before long. Thanks!
To download this. Go to MockUpGames.net and in the games info list menu there is a page for this asset with a link to download for unreal engine 4.13. (its the only download link at the moment)