Home Website Youtube GitHub

Custom Component Branching Skeleton

Hi

I’m new to mGear and I’m trying to create a custom component and was wondering is it possible to generate a branching skeleton within a component with the self.jnt_pos.append([]) approach most of the other comonents use to build the skeleton

I’ve tried to replicate several instances that i’ve found elsewhere but I either end up with one chain that doesnt branch or if it does branch then the branch is parented under the root joint and not the joint I specified.

Thanks in advance for any help you can give me.

Rich

1 Like

That’s ambitious. :slight_smile:

Just to check, why not just parent components to each other to make a hierarchy? What exactly are you trying to do by “branching”?

Yeah this is controlled by the parent joint index guide setting. But as far as I know, it only changes the joint parent, and doesn’t actually make the rig follow the new parent. That’s been an issue for a while, and I’m not sure it was ever changed.

Threads related to that:

But an easier workaround than making a custom component would be to just write a post process Python script that finds the parent joint, and fixes the constraint.

In this case I’m essentially trying to build a mechanical spine component that needs some additional joints to facilitate the mechanical articulations. I noticed the the EPIC_arm_01 does manage to branch its twist joints but not exactly sure how its doing it.

If I edit the control_01 to add in 2 extra joints and specify the first joint as the parent of both the other joints I still just get a single chain instead of a branch.

   self.jnt_pos.append(
        [
            self.ctl,  # driver node
            'base',  # joint name / tag
            'parent_relative_jnt',
        ]
    )
    self.jnt_pos.append(
        [
            self.ctl,  # driver node
            'branch1',  # joint name / tag
            'base',  # parent tag
        ]
    )
    self.jnt_pos.append(
        [
            self.ctl,  # driver node
            'branch2',  # joint name / tag
            'base',  # parent tag
        ]
    )

I get this:
image
instead of what I’m trying to get:
image

So, for reasons I havent figured out yet. I do get the branching hierachy so long as I make sure the base joint’s tag is in the jointRelatives dictionary

self.jointRelatives[“base”] = 0

Hi! sorry for the late reply
Yes it is possible.

the self.joint_pos now can be pass as a list of dictionary, list of list still supported for backwards compatibility

self.jnt_pos.append(
                        {
                            "obj": roll_off,
                            "name": "forearm",
                            "newActiveJnt": "elbow",
                        }
                    )

newActiveJnt is the key to refer to the joint relative

4 Likes

No worries, thanks for the reply. In the end I got it working but not until I’d also added in the jointRelatives bit at the bottom in the setRelation funtion

    self.jnt_pos.append([self.hips_ctl, "body", "parent_relative_jnt", False])
    self.jnt_pos.append([self.hips_ctl, "hips", "body", False])
    self.jnt_pos.append([self.chest_ctl, "chest", "body", False])
    self.jnt_pos.append([self.spineHips_cns, "lowerSpine",  "body", False])
    self.jnt_pos.append([self.spine_ctl, "centerSpine",  "body", False])
    self.jnt_pos.append([self.spineChest_cns, "upperSpine", "chest", False])

    self.jointRelatives["body"] = 0
    self.jointRelatives["hips"] = 1
    self.jointRelatives["chest"] = 2
    self.jointRelatives["lowerSpine"] = 1
    self.jointRelatives["centerSpine"] = 1
    self.jointRelatives["upperSpine"] = 2

I’ve still not quite figured out why it works, but it does :smiley:

1 Like