Created
January 24, 2023 19:17
-
-
Save bohdon/1273d97ffc88e424dcfe620040ec6e48 to your computer and use it in GitHub Desktop.
Center a twist joint between it's parent joint and an end joint in Maya.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
def center_twist_joint(twist_joint, end_joint): | |
""" | |
Center a twist joint between it's parent and an end joint | |
""" | |
root_joint = twist_joint.getParent() | |
center = (root_joint.getTranslation(space='world') + end_joint.getTranslation(space='world')) / 2.0 | |
twist_joint.setTranslation(center, space='world') | |
# select end joint, then twist joint | |
center_twist_joint(pm.selected()[1], pm.selected()[0]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment