【问题标题】:Find centre point in autodesk maya在 Autodesk Maya 中查找中心点
【发布时间】:2010-08-23 09:00:52
【问题描述】:

如何在 Autodesk Maya 中找到中心点...我知道使用中心枢轴但我找不到该点...如何找到使用 Autodesk Maya 创建的 3D 对象的确切坐标?谢谢。

【问题讨论】:

  • 如果您有兴趣,我有一个脚本可以对任何选择执行此操作位置相同。)

标签: maya


【解决方案1】:

只需进入菜单,修改 > 中心轴。这将使您的枢轴转到模型的中心。

【讨论】:

    【解决方案2】:

    这个问题实际上有两种可能的答案。

    对象的“中心”可能意味着:

    物体边界框的中心:你可以得到这个(使用python)

    bbx = cmds.xform(object, q=True, bb=True, ws=True) # world space
    centerX = (bbx[0] + bbx[3]) / 2.0
    centerY = (bbx[1] + bbx[4]) / 2.0
    centerZ = (bbx[2] + bbx[5]) / 2.0
    

    对象轴的位置:这与对象的位置不同,因为您可以移动轴而不更改 maya 报告的平移数。可以通过以下方式获得世界空间枢轴位置:

    pivot = cmds.xform(object, q=True, rp=True, ws=True)
    

    【讨论】:

      【解决方案3】:

      如果您对中心枢轴命令放置枢轴的位置感到满意,并且只想知道它在世界空间中的位置,您可以执行以下操作(假设您选择了对象)

      使用 PyMEL:

      import pymel.core as pm
      theObject = pm.ls(sl=1)[0]
      theObject.getRotatePivot()
      

      或使用 maya.cmds:

      import maya.cmds as mc
      mc.xform(query=True,rotatePivot=True)
      

      或使用 MEL

      xform -q -rotatePivot
      

      【讨论】:

        【解决方案4】:

        其实有一个命令叫objectCenter()

        这将为您提供特定点或对象的真实世界空间。

        将 maya.cmds 导入为 cmds

        # create a simple hierarchy
        cmds.polyCube( name='a' )
        cmds.polyCube( name='b' )
        cmds.parent( 'b', 'a' )
        cmds.move( 3, 0, 0, 'a', localSpace=True )
        cmds.move( 2, 2, 2, 'b', localSpace=True )
        X_COORD = cmds.objectCenter('b',x=True)
        # Result: 5 #
        # Get the center of the bounding box of b in local space
        XYZ = cmds.objectCenter('b', l=True)
        # Result: 2 2 2 #
        # Get the center of the bounding box of b in world space
        XYZ = cmds.objectCenter('b', gl=True)
        # Result: 5 2 2 #
        # Get the center of the bounding box of a in world space
        XYZ = cmds.objectCenter('a', gl=True)
        

        http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/index.html

        香农

        【讨论】:

          【解决方案5】:

          选择对象并选择:Animation > Create Deformers > Cluster。

          簇变形器现在将出现在对象的确切中心,用“C”表示,您可以在任何需要居中的位置上对齐簇。集群的实际中心点将位于“C”下方。

          【讨论】:

            【解决方案6】:

            在 Maya 中选择对象并查看右侧的面板。

            【讨论】:

              【解决方案7】:

              选择对象,然后在脚本编辑器中运行:

              string $sel[];
              $sel = `ls -sl`;
              print `getAttr ($sel[0]+".translate")`;
              

              这将在历史面板中打印 X、Y 和 Z 坐标。

              【讨论】:

                【解决方案8】:

                选择对象“Modify-Center pivot..” 如果不工作,只需选择对象并按'插入键,在你的键 木板。然后它将允许您设置枢轴..只需拖放您要设置的位置...

                如果您有任何疑问,请随时分享....

                【讨论】:

                  猜你喜欢
                  • 2019-03-16
                  • 1970-01-01
                  • 1970-01-01
                  • 2017-07-22
                  • 1970-01-01
                  • 1970-01-01
                  • 2018-03-13
                  • 2023-04-07
                  • 1970-01-01
                  相关资源
                  最近更新 更多