Home Website Youtube GitHub

Implementing EPIC twist joints on custom module

I’m trying to turn the leg_3jnt_01 module into something that’s compatible for game engines, but I’m having trouble creating the twist joints. Could someone show me what I’m doing wrong here? Copying the code from the EPIC_leg_01 module and tweaking it a bit doesn’t seem to be working for me:

self.divisions = o_set[“div0”] + o_set[“div1”] + o_set[“div2”] + 4

    self.div_cns = []
    for i in range(self.divisions):

        div_cns = primitive.addTransform(self.root_ctl,
                                         self.getName("div%s_loc" % i))

        self.div_cns.append(div_cns)

        driver = div_cns

        if i == 0:  # Hip joint
            self.jnt_pos.append([driver, "thigh"])
            current_parent = "root"  # Where the joint should be parented under
            twist_name = "thigh_twist_"  # Joint prefix
            twist_idx = 1  # Where the joint numbering should count up from
            increment = 1  # Positive for counting up, negative for counting down
        elif i == self.settings["div0"] + 1:  # Knee joint
            self.jnt_pos.append([driver, "calf", current_parent])
            twist_name = "calf_twist_"
            current_parent = "knee"
            twist_idx = self.settings["div1"]
            increment = -1
        elif i == self.settings["div0"] + self.settings["div1"] + 2:  # Hock joint
            self.jnt_pos.append([driver, "hock", current_parent])
            twist_name = "hock_twist_"
            current_parent = "ankle"
            twist_idx = self.settings["div2"]
            increment = -1
        else:  #
            self.jnt_pos.append(
                [driver,
                 twist_name + str(twist_idx).zfill(2),
                 current_parent])
            twist_idx += increment

    self.end_ref = primitive.addTransform(
        self.tws3_rot,
        self.getName("end_ref"),
        transform.getTransform(self.legBones[3]))
    self.jnt_pos.append([self.end_ref, 'end'])

This causes my joint hierarchy to look like this:
bad
…when I want it to look like this:
good

I also get the following errors despite having guide locators named “knee” and “ankle”:

// Warning: Joint Structure creation: The object knee can’t be found. Joint parent is NONE for leg_C1_div4_loc, from leg_C1 //
// Warning: Joint Structure creation: The object ankle can’t be found. Joint parent is NONE for leg_C1_div7_loc, from leg_C1 //
// Warning: Joint Structure creation: The object ankle can’t be found. Joint parent is NONE for leg_C1_div8_loc, from leg_C1 //
// Warning: Joint Structure creation: The object ankle can’t be found. Joint parent is NONE for leg_C1_div9_loc, from leg_C1 //

If anyone could help, I’d greatly appreciate it!

Never mind, it had to do with how how I set up the jointRelatives[] in the setRelation function.

1 Like