Skip to content

Instantly share code, notes, and snippets.

@gregtemp
Created June 5, 2014 17:29
Show Gist options
  • Save gregtemp/987c5861f0d4e258b117 to your computer and use it in GitHub Desktop.
Save gregtemp/987c5861f0d4e258b117 to your computer and use it in GitHub Desktop.
Aim a list of objects at the first object - in Maya
#aimAtFirst.py
import maya.cmds as cmds
selectionList = cmds.ls(orderedSelection = True)
if len( selectionList ) >= 2 :
print ( 'Selected Items: %s' %(selectionList))
targetName = selectionList[0]
selectionList.remove (targetName)
for objectName in selectionList:
print ('Constraining %s towards %s' % (objectName, targetName))
cmds.aimConstraint(targetName, objectName, aimVector=[0,1,0])
else:
print ('Please select 2 or more objects')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment