Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

ai decapitation in unity3d

Discussion in 'Editor & General Support' started by FireMe, Mar 21, 2012.

  1. FireMe

    FireMe

    Joined:
    Nov 18, 2010
    Posts:
    7
    Hi everyone, I am completely new to unity3d. and game design in general, I am more of a texture artist been using photoshop for many years. anyways lets get to the point.

    I am trying to work on a little project to see what I can put together in unity, So I decide to try and work on a sort of simply zombie game. What I am really interested in is the possibility of adding decapitation(Not sure if there is another word for this in games) to the zombie's, so really I am after some advice on the best way to do this or even if it is posible to do it in unity.

    For example I what the zombies to only die if you shoot them in the head,(like every zombie film, but not every zombie game) so for instance if you shot them in the leg enough times it would eventually become decapitated. which would then slow the zombie down, as it then has to drag itself along the ground with its arms to get to you. but also different weapons would take longer to decapitate eg. 15 pistol shots vs 1 shotgun shot.

    I hope you understand all this and I posted it under the correct section

    Thanks in advance

    FireMe
     
  2. Trackpants

    Trackpants

    Joined:
    Jan 5, 2012
    Posts:
    217
    It is definitely possible, I'm not entirely sure how you would go about actually severing the connection to certain limbs. But as for the damage code it would be pretty simple.

    You'd have to set up a health variable for each part of the zombie you would like to damage and change it so each gun does a different amount of damage. When a certain part is damaged enough, sever that limb, and use an if statement to change the way the zombie animates.
     
  3. FireMe

    FireMe

    Joined:
    Nov 18, 2010
    Posts:
    7
    Trackpants, thanks alot for your advice, so now I just have to figure out how to do it, lol :)
     
  4. multivac

    multivac

    Joined:
    Oct 27, 2009
    Posts:
    133
    Assuming your model is a skinned mesh, you could have the stumps attached to the model and skinned, but hidden for most of the time.
    When the sever event happens for the head for example, scale the head bone to a small radius and unhide the stump model, so the tiny head is hidden inside it. Also spawn a severed head model.
    This way you could support having several limbs removed, without making a new model for each combination.
    I haven't tried it, mind you, but it should work.
     
    Griffo likes this.
  5. FireMe

    FireMe

    Joined:
    Nov 18, 2010
    Posts:
    7
    multivac, thanks alot sounds like a good idea, its getting more complex than I thought it would be, wonder what the method is used in other games. that have decapitation wonder if it is a similar idea.
     
unityunity