Hello,
I'm currently working on a project in Cinema 4D Python. I'm trying to get the change in position and rotation when I make a softbody simulation. For example, when I try to let a object fall to the ground, I would like to get the new position and rotation at the end of the simulation. I tried the GetMg() function but it always returns the same value. Here is my code:
import c4d
doc: c4d.documents.BaseDocument
obj = c4d.BaseObject(c4d.Osphere)
obj[c4d.ID_BASEOBJECT_REL_POSITION] = c4d.Vector(0,100,0)
softbody_tag = c4d.BaseTag(c4d.Tcloth)
c4d.CallButton(softbody_tag, c4d.CLOTH_PBD_STRUT_SOFTBODY_UPDATE_BUTTON)
obj.InsertTag(softbody_tag)
doc.InsertObject(obj)
c4d.EventAdd()
for frame in range(90):
doc.SetTime(c4d.BaseTime(frame,doc.GetFps()))
doc.ExecutePasses(None, True, True, True, 0)
c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)
print(obj.GetMg())
Could someone please guide me on how I can accurately determine the position and rotation changes in this scenario? Any help or suggestions would be greatly appreciated.
Thank you in advance!