I want to damage individual body parts of the enemy, like the legs and arms. The player would attack certain body parts and they would get separated from the monster (like Monster Hunter World for example, you could separate tail from the monster after damaging it).
My question is how would I trace the hit for the individual parts rather than the whole mesh itself. Secondly, would I need separate health for each individual body part (e.g. like Leg 1, Leg 2 etc.)?
I am more concerned with implementation and functionality rather than aesthetics of it. Any help would be greatly appreciated!
Bonus Quest: I want the camera to lock on the specified Body Part when the player presses a button. Any ideas how to do it?
If you want to group bones together …say (r_upperarm, r_lower arm, r_hand…fingers), then create an r_arm phys material and apply it to each r_arm component shape under collision.
When you get a hit you’d get the phys material hit, convert to string → switch on string → calc damage, apply it etc etc.
For grouping damage … say arm you’d create a float variable for each grouping (r_arm, r_leg…hips, chest, head etc) and set it’s default health. You’d deduct damage directly to the grouping.
e.g. hit in r_hand would apply damage deduction to r_arm float.
I’m using collision overlaps to acquire the Hit Result (returns individual components and bones names). This would work for Traces too. The key factor to the dismemberment is modular parts or the ability to dynamic split the meshes. I’m using modular static/proc meshes, voxel objects. and collision components attached to the skeleton bone/sockets. The static/proc meshes/voxel objects for visuals & collisions, and collision objects for invisible weakpoints. This allows me to dismember/destroy individual parts with multiplayer slicing mechanic to be expanded until multi-slice bullet damage.
My mistake, I should have mentioned that I am using Collision Overlaps traces/events instead of line traces. I was testing for weapon collision against body collision.
this grouping idea is really nice and will make the code much cleaner I think
My issue with this is that I was unable to properly approximate the skeletal mesh of monster with collision components. Any ideas how to get better collision approximation?
BTW nice looking game you have there!
This is old thread but it was first return on google. I want to update with just a small tip, because all of the suggested solutions I’ve found are more tedious than necessary.
Assuming that you are testing hits on a physics asset, and the physics asset volumes derive name from skeleton, you don’t need to do the extra steps to setup physical materials. You can just search the bone name string for categories like this:
You can just dump your categories into an array for better code but the idea here is that you only need to search specific substrings within the bone names, so you don’t have to do any additional setup on top of the physics asset.