Exemple #1
0
 public void ForEachJoint(JointCallback func)
 {
     for (int i = 0; i < joints.Count; i++)
     {
         func(joints[i]);
     }
 }
Exemple #2
0
    // Calls a function for all end joints from a starting joint
    public static void ForAllEnds(IK_Joint startingJoint, JointCallback func)
    {
        if (startingJoint == null)
        {
            return;
        }

        if (startingJoint.jointType == JointTypeEnum.End)
        {
            func(startingJoint); // Call function for first joint
        }
        else
        {
            foreach (IK_Joint joint in startingJoint.childrenJoints)
            {
                if (joint.jointType == JointTypeEnum.End)
                {
                    func(joint);
                }
                if (joint.childCount > 0) // If has children, call function on them too
                {
                    ForAllEnds(joint, func);
                }
            }
        }
    }
Exemple #3
0
    // A way to call a function for all joints branching off of a starting joint (including the starting joint)
    public void ForAllJoints(IK_Joint startingJoint, JointCallback func)
    {
        if (startingJoint == null)
        {
            return;
        }

        func(startingJoint); // Call function for first joint
        foreach (IK_Joint joint in startingJoint.childrenJoints)
        {
            func(joint);
            if (joint.childCount > 0) // If has children, call function on them too
            {
                ForAllJoints(joint, func);
            }
        }
    }