April
18
2014

Some equipment, like trousers or sleeves, require a more complex setup to follow the combatant’s movement. Equipment Viewers use Child Linking to achieve this.

Child linking is used to link a child object of the equipment’s prefab to a child object of the combatant’s prefab when it’s equipped. Let’s see how this works by linking trousers to the combatant’s legs.

The hierarchy of the game objects

To successfully link an equipment to a combatant, the structure of the objects armature has to be equal where they’ll be linked.

The combatant’s prefab hierarchy looks like this:

gameplay_3_child_linking1

The trousers’ prefab hierarchy looks like this:

gameplay_3_child_linking2

We’ll be linking the different child objects of the left and right leg to the equivalent object of the trousers, e.g. Armature/Thight_L on the trousers will be linked to Armature/Tight_L on the combatant.

Setting up the equipment viewer

Where you place the equipment viewer component on your combatant’s prefab (and which Equipment Part it uses) depends on your actual game objects and equipment system design. We’ll just focus on linking the child objects.

To link a child object of the equipment to the combatant, click on Add Child Link in the equipment viewer’s inspector.

Left leg

First, we’ll link the left thigh.

  • Child Name (Equipment)
    Set to Armature/Thigh_L.
    This is the path to the child object on the equipment
  • Link To (Root)
    Set to Armature/Thigh_L.
    This is the path to the child object on the combatant (starting from the root, ignoring the actual position of the equipment viewer).

Now, click on Add Child Link again to add the left upper leg.

  • Child Name (Equipment)
    Set to Armature/Thigh_L/Leg_Upper_L.
  • Link To (Root)
    Set to Armature/Thigh_L/Leg_Upper_L.

Click on Add Child Link again to add the left lower leg.

  • Child Name (Equipment)
    Set to Armature/Thigh_L/Leg_Upper_L/Leg_Lower_L.
  • Link To (Root)
    Set to Armature/Thigh_L/Leg_Upper_L/Leg_Lower_L.

And now, the left foot.

  • Child Name (Equipment)
    Set to Armature/Thigh_L/Leg_Upper_L/Leg_Lower_L/Foot_L.
  • Link To (Root)
    Set to Armature/Thigh_L/Leg_Upper_L/Leg_Lower_L/Foot_L.

Right leg

Click on Add Child Link again to add the right thigh.

  • Child Name (Equipment)
    Set to Armature/Thigh_R.
  • Link To (Root)
    Set to Armature/Thigh_R.

Again, click on Add Child Link again to add the right upper leg.

  • Child Name (Equipment)
    Set to Armature/Thigh_R/Leg_Upper_R.
  • Link To (Root)
    Set to Armature/Thigh_R/Leg_Upper_R.

The right lower leg.

  • Child Name (Equipment)
    Set to Armature/Thigh_R/Leg_Upper_R/Leg_Lower_R.
  • Link To (Root)
    Set to Armature/Thigh_R/Leg_Upper_R/Leg_Lower_R.

Finally, the right foot.

  • Child Name (Equipment)
    Set to Armature/Thigh_R/Leg_Upper_R/Leg_Lower_R/Foot_R.
  • Link To (Root)
    Set to Armature/Thigh_R/Leg_Upper_R/Leg_Lower_R/Foot_R.

And that’s it – don’t forget to apply the changes to your combatant’s prefab.

From now on, when this equipment viewer displays an equipment with matching child objects, they’ll be linked to the movement of the combatant’s child objects.