Ejemplo n.º 1
0
        private static void CreateJoint(Dictionary <string, Joint> list, Transform bone, Joint parent)
        {
            // check that it is not already created
            Joint node = list.FirstOrDefault(x => x.Key == bone.name).Value;

            if (node != null)
            {
                return;
            }

            // create the joint and add to the list
            node = new Joint();
            node.Init(bone.name);
            node.SetRawtData(bone.position, bone.rotation);
            list.Add(bone.name, node);

            // if this is a child joint, set the property
            if (parent != null)
            {
                parent.AddChild(node);
            }

            // traverse children to create tree
            foreach (Transform child in bone)
            {
                CreateJoint(list, child, node);
            }
        }
Ejemplo n.º 2
0
        private static void UpdateJoint(Dictionary <string, Joint> list, Transform bone)
        {
            Joint node = list.FirstOrDefault(x => x.Key == bone.name).Value;

            if (node != null)
            {
                node.SetRawtData(bone.position, bone.rotation);
            }
        }