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?

thanks,
knekke

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:

AARRGGHH!!!
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()):
    context.currentFrame(frame)
    print cam.matrixWorld.toEuler()
    #location = cam.matrixWorld.translationPart()
    #locx.addBezier((frame,location[0]))
    #locy.addBezier((frame,location[1]))
    #locz.addBezier((frame,location[2]))

    
    
    #rotation = cam.matrixWorld.rotationPart().toEuler()
    #rotx.addBezier((frame,rotation[0]/10.0))
    #roty.addBezier((frame,rotation[1]/10.0))
    #rotz.addBezier((frame,rotation[2]/10.0))
    
#cam.setIpo(ipo)

thanx in advance,
knekke

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)

http://claudiojd.googlepages.com/bake2ipo.py

bye! :slight_smile:

or you want record rot and loc data from camera?
yes!
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:
http://www.heulfritze.de/stuff/contraint-test.blend
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!!
knekke

maybe exist an offset in apply bezier points.

later see it.

tnx

bye