Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # snap to surface
- from pymel.core import *
- # select list, then snap to object
- sl = selected()
- startL = spaceLocator(n="startL")
- endL = spaceLocator(n="endL")
- cp = createNode("closestPointOnMesh",n="snapperCheck")
- snapList = sl[:-1]
- snapto = sl[-1]
- snapto.getShape().worldMatrix[0] >> cp.inputMatrix
- startL.translate >> cp.inPosition
- cp.position >> endL.translate
- snapto.getShape().worldMesh[0] >> cp.inMesh
- for s in snapList:
- st = s.getTranslation()
- move(startL, st)
- et = endL.getTranslation()
- move(s,et)
- delete(cp,startL,endL)
Advertisement
Add Comment
Please, Sign In to add comment