Skip to content

Instantly share code, notes, and snippets.

@kohyuk91
Created November 2, 2019 06:48
Show Gist options
  • Select an option

  • Save kohyuk91/07f05e08b505c3560292f3bb75003141 to your computer and use it in GitHub Desktop.

Select an option

Save kohyuk91/07f05e08b505c3560292f3bb75003141 to your computer and use it in GitHub Desktop.
import maya.cmds as mc
""" 로케이터 리스트 """
loc_list = mc.ls(selection=True) # [u'locator1', u'locator2', u'locator3']
for loc in loc_list:
""" 사각뿔 콘생성 """
polycone = mc.polyCone(subdivisionsAxis=4)[0]
""" 콘을 180도 회전 """
mc.xform(polycone, worldSpace=True, rotation=[180,0,0])
""" 콘을 translateY를 1 올림 """
mc.xform(polycone, worldSpace=True, translation=[0,1,0])
""" 콘의 피봇을 월드 중앙으로 옮기기 """
mc.xform(polycone, worldSpace=True, pivots=[0,0,0])
""" 콘을 프리즈 """
mc.makeIdentity(polycone, apply=True)
##############################################################################
""" 로케이터의 포지션을 알아내기 """
loc_position = mc.xform(loc, q=True, worldSpace=True, translation=True)
""" 콘을 로케이터에 이동 시키기 """
mc.xform(polycone, worldSpace=True, translation=loc_position)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment