Search Unity

Attach armor to armature

Discussion in 'Scripting' started by Royall, Apr 17, 2014.

  1. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    120
    Hi there,

    I am trying to figure out how to attach armor (swappable) to my character armature.

    It doesnt have to be weighted so I thought a simple parenting would do.

    I created an empty gameobject with a meshfilter on it and attached it to the armature chest..

    Now i used the following script to create the player and swap the mesh of the chest armor:

    var o = Instantiate(playerObject, Vector3(70, 7.92, 102), Quaternion.identity); o.Find("Armature/Stomach/Chest/ChestObject").gameObject.GetComponent(MeshFilter).sharedMesh = gearObject.GetComponent(MeshFilter).sharedMesh;

    Problem is I don't know if this is a good way to do it... With this I also have another problem... My boots and bracer models are 1 mesh. But they should move independently on the two feet and arms. If I want to use this method I need to split my boots and bracers into 2 objects..

    Any help?