- Home /
How can I do an enemy damage with different parts of the body?
I have an enemy in my scene where I want that when I shot in a certain part of the body like the head, for example, the damage is greater than if he gave in the feet, in few words in some parts I will quit more and in others less. But I want to know what do you need to do in the enemy and where the script has to be and how have to be the scripts.
I really help. Please someone help me. Thaks for future.
you can declare the colliders, for example: the head, if bullet hit the collider "head" then, multiply the damage for 5, for example.
Answer by chemicalvamp · Jan 04, 2012 at 10:19 PM
I would use a custom made low-poly collision mesh for each of the different damage areas, Or perhaps one for each body part then you can also make multiple body part versions to show localized damage.
It depends on how your enemy is set up.
The important part is to have one Collider component for each body part you want to take damage. Each GameObject can only have one Collider, so you will need a GameObject for each Collider.
If your enemies are animated, and if the animation skeleton is exposed in unity (the transforms which deform the mesh), you can attach a Collider to each bone.
Answer by UNITY3D_TEAM · Jun 14, 2012 at 11:57 AM
use box collider to detect the different part of the body.u can edit the size of collide r .to achieve ur goal
Answer by JayPnchl · Dec 27, 2019 at 11:31 AM
i made a system which consists of enemies with 3 different parts of the body with red color (1)if the player hits the red colored part, the enemy takes damage.( till this it is done) (2)if the player hits the non-red colored part twice, i want to spawn another enemy at the same spot ( i have no idea how this will be done).
I have used rays to detect my enemies red colored part by getting the hitinfo and comparing the tag with enemy and using the isTrigger method to detect the red part
to instantiate i have used two spawning points which spawn 3 different types of enemies every 7 secs
help me with the (2)