Swing Twist Decomposition¶
Creates a node network to extract swing/twist rotation of a transform to drive another transforms offsetParentMatrix.
The network calculates the local rotation swing and twist offset around the specified twist axis relative to the local rest orientation. This allows users to specify how much swing and twist they want to propagate to another transform. Uses include driving an upper arm twist joint from the shoulder and driving forearm twist joints from the wrist.
Since the network uses quaternions, partial swing and twist values between 0.0 and 1.0 will see a flip when the driver transform rotates past 180 degrees.
The setup can either be made with several standard Maya nodes, or the compiled plug-in can be used to create a single node. Setting cmt.settings.ENABLE_PLUGINS to False will use vanilla Maya nodes. Otherwise, the compiled plug-in will be used.
Example Usage¶
The twist decomposition network can be accessed in the cmt menu:
CMT > Rigging > Connect Twist Joint
Twist child of shoulder:
shoulder
|- twist_joint1
|- twist_joint2
|- elbow
create_swing_twist(shoulder, twist_joint1, twist_weight=-1.0, swing_weight=0.0)
create_swing_twist(shoulder, twist_joint2, twist_weight=-0.5, swing_weight=0.0)
Twist forearm from wrist:
elbow
|- twist_joint1
|- twist_joint2
|- wrist
create_swing_twist(wrist, twist_joint1, twist_weight=0.5, swing_weight=0.0)
create_swing_twist(wrist, twist_joint2, twist_weight=1.0, swing_weight=0.0)
Use no plugins:
import cmt.settings as settings
settings.ENABLE_PLUGINS = False
create_swing_twist(wrist, twist_joint1, twist_weight=0.5, swing_weight=0.0)
create_swing_twist(wrist, twist_joint2, twist_weight=1.0, swing_weight=0.0)
-
cmt.rig.swingtwist.
create_swing_twist
(driver, driven, twist_weight=1.0, swing_weight=1.0, twist_axis=0)[source]¶ Create a node network to drive a transforms offsetParentMatrix from the decomposed swing/twist of another transform.
Setting cmt.settings.ENABLE_PLUGINS to False will use vanilla Maya nodes. Otherwise, the compiled plug-in will be used.
- Parameters
driver – Driver transform
driven – Driven transform
twist_weight – -1 to 1 twist scalar
swing_weight – -1 to 1 swing scalar
twist_axis – Local twist axis on driver (0: X, 1: Y, 2: Z)