Making objects follow paths; 2.27 vs 2.28 and later

I’ve got a python script which reads the position of an obect moving along a path and
positions the camera at the same location:

        obj = Blender.Object.Get("Camera")   
        newpos = findPos ("pathobject")
        obj.LocX = newpos[0][0]
        obj.LocY = newpos[0][1]
        obj.LocZ = newpos[0][2]
        obj.RotX = newpos[1][0]
        obj.RotY = newpos[1][1]
        obj.RotZ = newpos[1][2]

findPos() is a procedure which get the matrix of an object and converts into a
positon and Euler angles. It works fine with v2.27, but v2.28 thru 2.31a have a
one frame “lag”; the camera is positioned at the last object position. Using the
arrow keys to increment or decrement the frame number consistently show the
camera at the last object position.

Am I missing something here? Was there a change in the new Python API so that
scripts are executed prior to updating objects with speed IPOs? That’s what seems
to be happening. I’ve noticed something similar when running things in the back-
ground mode; seems like the scripts aren’t called before rendering the first frame.


well, I don’t know why this happens, but can you change your script to get the position one frame later to implement it in the actual frame? you know, like for the frame n, get the position at n+1… maybe that will solve the problem. For the first frame, just make it double, only start the move on frame 2. Hope the idea is something you can implement… I’m no programmer, just a student having fun with blender, but it sounds like a sequence math problem to me :D! Try implementing this, and see if it works :wink:

Tried this using Blender.Set(‘curframe’,frame+1) just for the heck of it, but it still executes the
script before the update. However, if I do Blender.Redraw() before reading the object’s
matrix, this does “fix” it. Thanks for the suggestion. However, hopefully someone can explain
why this behavior has changed.