Bootstrap

python.c4d里的位移操作

import c4d

def main():
    Plane = doc.SearchObject("Plane")
    oldPOS=Plane.GetRelPos()#获取旧的位置值
    Newpos=oldPOS + c4d.Vector(0, 100, 0)#给旧的位移添加一个矢量位移修改
    Plane.SetAbsPos(Newpos)#位移Plane物体
main()

这样和maxscript里写的话是错误的。

import c4d

def main():
    Plane = doc.SearchObject("Plane")
    Plane.transform.position= c4d.Vector(0, 100, 0)
main()

Traceback (most recent call last):
  File "Python", line 6, in <module>
  File "Python", line 5, in main
AttributeError: 'c4d.BaseObject' object has no attribute 'transform'

另外查看 c4d里旋转对象c4d.python 旋转一个对象_c4d选中1对象旋转-CSDN博客

;