Website Youtube GitHub

Rotation isolation on FK component


#1

Hey,

I am going to build a neck and head control using the FK component or the FK spring component. I have used other rigs that have isolation on the rotation, as shown in the example GIF. In this example I created it in a post script but I am curious to know if I am missing something and it is already there in the component.

I think it is part of the mgear neck component, but it generates too many controls for my needs. That’s why I am using FK instead.

isolate_rotation


Rotation space switch for control_01?
#2

Hi @Torben_Sottrup I think you are doing it right using a custom step in post. :slight_smile:

Cheers


#3

Thanks @Miquel
If anyone needs this kind of functionality here is the script I used:

import pymel.core as pm

print 'POST: Head isolate script'

# control to isolate
isolate_ctrl = pm.PyNode('neck_C0_fk0_ctl')

# spaces to add to isolation
global_ctrl = pm.PyNode('cog_C0_ctl')
parent_ctrl = pm.PyNode('spine_C0_ik1_ctl')

isolate_constrain_grp = pm.PyNode('neck_C0_fk0_npo')
isolate_attr_holder = pm.PyNode('neckSettings_C0_ctl')

# create extra top group for isolate constrain
pm.select(isolate_constrain_grp, r=True)
isolate_grp = pm.group(n=isolate_constrain_grp.name() + '_isolate', empty=True, world=True)
pm.delete(pm.parentConstraint(isolate_ctrl, isolate_grp, mo=False))

isolate_constrain_grp_parent = isolate_constrain_grp.getParent()
pm.parent(isolate_constrain_grp, isolate_grp)
pm.parent(isolate_grp, isolate_constrain_grp_parent)

# add orientConstraint
con = pm.parentConstraint(global_ctrl, parent_ctrl, isolate_grp, mo=True, weight=0, skipTranslate=['x', 'y', 'z'])
con.interpType.set(2)

# add attribute for switching spaces
pm.addAttr(isolate_attr_holder, type='float', min=0, max=1, dv=0, longName='isolate_rotation', keyable=True)

# connect attr to constraint target weights
isolate_attr_holder.isolate_rotation >> con.getWeightAliasList()[0]

rev_node = pm.createNode('reverse')
isolate_attr_holder.isolate_rotation >> rev_node.inputX
rev_node.outputX >> con.getWeightAliasList()[1]

#4

@Torben_Sottrup thanks for sharing this! :smiley: