Detect the Side of the Body That a Joint is on, Maya, Python, Function

Posted by:

  1. #This function will return the side of the body the passed joint is on
  2. #note, it assumes that the character is oriented down the Z axis with the joint's X transform being to either side of the character
  3. #assumes no nulls or intermediate joints exist above the joint being passed
  5. import maya.cmds as cmds
  7. def detectSideOfBody(jointToCalculate):
  8. transformPosition = cmds.xform(jointToCalculate, query = True, translation = True)
  10. '''The following decides whether the selected joint is on the right or left hand side of the body acording to its position in X
  11. Note! this assumes that the skeleton was setup with the standard facing down the Z axis with Y being world up and
  12. X as the midline(saggital) axis.
  13. '''
  14. global globalSideOfBody
  15. if(transformPosition[0] > 0):
  16. sideOfBody = 'Lft'
  17. else:
  18. sideOfBody = 'Rt'
  20. return sideOfBody


  Related Posts

You must be logged in to post a comment.