Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Anchorage
    A

    Anchorage

    @Anchorage

    0
    Reputation
    1
    Posts
    59
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    Anchorage Follow

    Best posts made by Anchorage

    This user does not have any upvoted posts yet.

    Latest posts made by Anchorage

    Get rotation of animated object with python

    Hi
    I'm trying to write python script for Cinema4D R17 that would go through all frames and output rotation of object that is animated. The script works but it always returns the same rotation even when object is animated and its rotation is changing in each frame. How do I fix this?

    Here is the code I'm using

    import c4d
    import c4d.utils
    import math
    from c4d import gui
    
    def main():
        currentDoc = c4d.documents.GetActiveDocument()
        docFps = currentDoc.GetFps()
        lastFrame = currentDoc.GetMaxTime().GetFrame(docFps)
        
        print "Document framerate is " + str(docFps)
        print "Last frame is " + str(lastFrame)
    
        for x in range(0, lastFrame + 1):
            currentDoc.SetTime(c4d.BaseTime(x, docFps))
            c4d.EventAdd()
            cubeObj = currentDoc.SearchObject("Cube")
            cubeObjRotation = cubeObj.GetAbsRot()
            cubeObjRotation = cubeObjRotation * 180 / math.pi
            print "Frame" + str(x) + " - Cube rotation is " + str(cubeObjRotation)
            
    if __name__=='__main__':
        main()
    
    posted in Cinema 4D SDK •