Rotation ipos for tack2constraint camera

Hi there,
I’d like to export my camera data, but since I animate my camera using track 2 constraint i won’t get the rotation data.
I tried Blender.Object.getEuler() but to no success (always returns [0,0,0]).
Has anyone done a script for it or has an idea where to start so that i can do it myself?


use ob.matrixWorld

if you need to convert that into a rotation…
ob.matrixWorld.rotationPart().toEuler() i think- rotation part may not be needed…

Thanks a lot! That seems to work :smiley:

Just found out that it works only as long as the object the camera is tracked to isn’t moving. Camerarotation won’t follow if it moves :eek:. Maybe i have to update the object the camera is tracked to for every new frame, but i have no idea. I’m worrying for several hours by now. Maybe someone has a hint for me?? Here’s what i have done so far:

import Blender as B

scn = B.Scene.getCurrent()
obj = B.Object.GetSelected()
cam = obj[0]

context = scn.getRenderingContext()

ipo = B.Ipo.New('Object','CamIpo')
locx = ipo.addCurve("LocX")
locy = ipo.addCurve("LocY")
locz = ipo.addCurve("LocZ")
rotx = ipo.addCurve("RotX")
roty = ipo.addCurve("RotY")
rotz = ipo.addCurve("RotZ")

for frame in range(1,context.endFrame()):
    print cam.matrixWorld.toEuler()
    #location = cam.matrixWorld.translationPart()

    #rotation = cam.matrixWorld.rotationPart().toEuler()

thanx in advance,

sorry, i’m not understand (and sorry my english)

why you baking (crate a ipo cruve) for location camera?

or you want record rot and loc data from camera?

i have a script for this, baking on a ipo datablock loc and rot for select object. remember after run the script, delete the constraints or set 0 (zero) they influence. (same for parents if the camera is child of)

bye! :slight_smile:

or you want record rot and loc data from camera?
Thanks a lot for your script!! Seems to do exactly what i’m trying :slight_smile:
But there seems to be a timing problem.
When i run your script on the camera of this scene:
the result is 1 frame behind for the fist 10 frames,
and then from frame 11 the camera starts to move there is something wrong with the rotation data. But i think i can handle it from there. Again:
Thanks a lot!!

maybe exist an offset in apply bezier points.

later see it.