BGP2017 – Amputation

For the vertical slice of the game the way you ”heal” the orcs is by amputating the hurt limbs of the orc using the axe and then attaching a prosthetic.

To implement this the mesh is split up into 14 separate objects which are all rigged to one rig. For each limb which can be amputated there is a child object in the rig hierarchy at the same level as the limb which can be amputated. This object has a limb component as well as a box collider.

The limb component handles the amputation and attachment of the prosthetic

First of all the component contains the current state of the limb. Which can be normal, hurt, open wound or prosthetic attached.

This state is read by another component to handle the orc taking damage from being hurt or having an open wound, the orc component.

If the state is hurt, the component changes the material of the mesh to visually show the limb needing to be amputated.

Second, the component handles amputation. When the collider attached to the object is entered by the axe, a function in the component is called. This function handles what happens when the limb is amputated.

First it checks if the parent of the limb has been cut already. If the parent has been cut, the function returns.

Next it checks all the child limbs if they have been amputated already. Example: Upper arm amputates the upper arm, fore arm and hand.

But if the hand has already been amputated we need to turn of the various things which happen when a limb is amputated, for example activation of the collision box for prosthetic attachment, blood particles and the open wound state of the limb.

When the limb is amputated it also spawns the corresponding set of parts which have been amputated.

The player can then attach a prosthetic and the limb has been ”healed”.

About Martin Carlsson

2015 Programming