Blog

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
  5.  
  6. snapToObj(targetObject, objectToSnap)
0

About the Author:

I RUN this joint! And I am a digital artist. BFA from the University of Colorado with an emphasis in 3D Animation. I worked in medical animation for some time. I then narrowly escaped with an only partially crushed spirit. Since then I have been expanding my skill set, reaching out into custom coding, game and app development.

  Related Posts

Add a Comment