Hi @Leo_Saramago,
while I agree that using transforms/matrices is more convenient than vectors for position, scale and rotation, it frankly do not quite get why you cannot use the latter since matrices are exactly the same, just written in a more convenient form.
There are however multiple convenience methods attached to BaseDocument, .AnimateObject(), .AutoKey(), .Record() and .RecordKey(), with which you can animate nodes without having to deal with the more atomic animation types directly. I have attached a very simple example at the end for the .Record() method, in the hopes that this reflects what you are trying to do.
Cheers,
Ferdinand
"""Little example for one of the animation convenience methods of
BaseDocuement.
Select an object and run the script, it will create a short animation for it.
As discussed in:
plugincafe.maxon.net/topic/13228/
"""
import c4d
import math
def main():
"""
"""
# Get out when there is no object selected. op is predefined as the
# primary selected object in a script module.
if op is None:
raise ValueError("Please select an object.")
# Set a frozen rotation for that object.
op[c4d.ID_BASEOBJECT_FROZEN_ROTATION] = c4d.Vector(0, 0, math.pi)
# Set a frozen translation for that object.
op[c4d.ID_BASEOBJECT_FROZEN_POSITION] = c4d.Vector(50., 0, 0)
# Take ten steps.
for t in range(10):
# Create a BaseTime in 1/10th of a second intervals from our step count.
bt = c4d.BaseTime(t * .1)
# Set the document to that time. doc is like op a predefined script
# module attribute, pointing to the currently active document.
doc.SetTime(bt)
# Set the rotation of our object.
rotation = t * .1 * math.pi
op[c4d.ID_BASEOBJECT_REL_ROTATION] = c4d.Vector(rotation, 0, 0)
# You can also make use of SetMg() here if you want to, this however
# will not respect the frozen values, or only in a way that is probably
# not what you want. So if you set a frozen offset of (100, 0, 0)
# for example and then write an offset of (0, 0, 0) into the object
# via SetMg(), the object will then have the relative position of
# (-100, 0, 0) in the coordinate manger, because (0, 0, 0) in world
# coordinates is (-100, 0, 0) in frozen coordinates. Keyframing with
# SetMg() will however work fine.
# mg = c4d.utils.MatrixRotZ(rotation)
# mg.off = c4d.Vector(t * 10, 0, 0)
# op.SetMg(mg)
# Record the active object(s) in the document. Additional convenience
# methods for animating stuff are BaseDocument.AnimateObject(),
# .AutoKey(), and .RecordKey(). Se documentation for details.
doc.Record()
# Push an update event to Cinema 4D, so that our editor is getting updated.
c4d.EventAdd()
if __name__=='__main__':
main()```