model dismemberment

manscom

Member
hi

I looking for a solution of dismembering a model when he gets hit, about this, I am thinking if I could add a new float variable like "HitBoxHealth" on the HitBoxs which location at the health component below.
螢幕截圖 2021-08-19 下午5.16.53.png

for this, let say if a specific part of the hotbox gets enough damage then that part will do something like dismembering itself.

Therefore, my question is how do I add a new variable on the hotbox because it seems using in some other object as well for example the melee weapon. Please help me to solve this problem.

Thank You!
Man
 
You can add the Health component to the individual colliders, so instead of having one Health component with multiple hitboxes selected, you could add a Health component to each of those colliders. (However I'm not 100% sure if that would work if those colliders are all child objects of the character, but it's worth testing.) Then you could use the death event on each of those Health components to fire your logic for destroying each object etc.
 
You can add the Health component to the individual colliders, so instead of having one Health component with multiple hitboxes selected, you could add a Health component to each of those colliders. (However I'm not 100% sure if that would work if those colliders are all child objects of the character, but it's worth testing.) Then you could use the death event on each of those Health components to fire your logic for destroying each object etc.
thanks for your reply, it is working on a single object, but I need to get help for one more thing. so since my health components are using the ragdoll colliders and I want to add one more collider for a head shot area that will kill the enemy immidely like the image below.螢幕截圖 2021-08-24 下午5.06.14.png
for this, I create an empty object with a collider and a kinematic rigidbody attach on it, but the detection of the gunShot is not steadable, it always miss the shoot and sometimes even pass through all the colliders and hit the floor, I found this problem when the enemy character is a moving object, may I know how would you setup this situation?

Thank you!
Man
 
Hm if you have 2 small colliders overlapping each other like that then I think Unity's collision detection might always have some trouble there with raycasts and whatnot. You could try adjusting the rigidbody's collision detection settings (e.g. interpolation + continuous may improve the accuracy of the overlap detection there, but just be aware it may impact performance especially if you have lots of these objects at once). You also could try adjusting the colliders so they don't overlap, e.g. use a boxcollider for the bottom half of the head.
 
Hm if you have 2 small colliders overlapping each other like that then I think Unity's collision detection might always have some trouble there with raycasts and whatnot. You could try adjusting the rigidbody's collision detection settings (e.g. interpolation + continuous may improve the accuracy of the overlap detection there, but just be aware it may impact performance especially if you have lots of these objects at once). You also could try adjusting the colliders so they don't overlap, e.g. use a boxcollider for the bottom half of the head.
I tried, I don't understand why the result get worst haha.. the head shoot area never detect the raycast..... that's wired
 
I think I found the solution for this, I am sharing it here.

so I simply check the animate physics on the animator component and it fixed the two overlapping colliders, I not sure if this is the most important action I did, bceause before clicking the "animate physics" option I also setup two layers to define both of the objects which are the Ragdoll parent object for the head and the empty object for he head shot area and also manuly setup these layer collider to ignore each other in the projectsetting -> Physics.

Now, every bullet is doing prefect!
 
Top