Snap an object to the center point of another object, Maya, Script, Python

Posted by:

I often have to snap one object to another and then freeze transforms on the object that I snapped, so I wrote this procedure:


  1. def snapToObj(target, objToSnap):
  2. tempPointConstraint = cmds.pointConstraint(target, objToSnap, maintainOffset = False)
  3. cmds.delete(tempPointConstraint)
  4. cmds.makeIdentity(objToSnap, apply = True, translate = True, rotate = True, scale = True) #Freeze Transforms
  6. snapToObj(targetObject, objectToSnap)
  Related Posts

You must be logged in to post a comment.