[英]Fix object position on frames to animate it
我想根據幀號在不同位置修復 object(例如 Ocube)。
這是我的代碼,靈感來自我找到的教程( https://github.com/PluginCafe/cinema4d_py_sdk_extended )
# Creates the object in memory
obj = c4d.BaseObject(c4d.Ocube)
# Retrieves BaseTime of frame 0, 20
start = 0
end = 20
# Loops through the frames
for frame in range(start, end + 1):
# Move the cube to some position
obj.SetRelPos(c4d.Vector(20+frame*20))
# Creates the track in memory. Defined by it's DescID
trackY = c4d.CTrack(obj, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_REL_POSITION, c4d.DTYPE_VECTOR, 0),
c4d.DescLevel(c4d.VECTOR_Y, c4d.DTYPE_REAL, 0)))
# Inserts the track
obj.InsertTrackSorted(trackY)
# Inserts the object in document
doc.InsertObject(obj)
# Pushes an update event to Cinema 4D
c4d.EventAdd()
問題:
此代碼無法修復幀中的 object。 立方體在每次循環迭代時更改 position 但它不是逐幀固定的。 我想我需要將軌道與框架相關聯,但我還沒有找到執行此操作的文檔。
我想要的是
在每次循環迭代中,我想記錄一個 object position 作為“記錄活動對象”。
並自動創建出現在時間線上的軌道:
問題:
謝謝
我在閱讀文檔時遺漏了一些東西,但我終於在此鏈接上找到了適合我需要的答案:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.