On 06/06/2016 at 14:02, xxxxxxxx wrote:
Hi,
In attempting to store the frame-by-frame position of an object being driven by a rigid body simulation/dynamics tag, it seems like there is a delay in the object coordinates retrieved by python, and the actual position.
For example, creating a simple dynamics scene with a cube (rigid body tag) and a floor (collider body tag), I put a python tag on the cube with the following code:
import c4d
def main() :
cTime = doc.GetTime().GetFrame(doc.GetFps())
cPos = op.GetObject().GetMg().off
print cTime, cPos
If I step through the project frame by frame, the console prints out the correct position values. But if I play the animation, and then hit pause , it seems to perform one last iteration to update to the correct position--but it registers on the same frame.
This is causing issues in a different application where I am trying to approximate velocity/accel based on previous, current, and next frame positions.
Can anyone help me understand why that delay is happening, or what I might be able to do to prevent/work around it?
Thanks,
--Marcus