First of all, I’d like to thank Jamesk for his walk-o-matic script, since I borrowed some of the functions from there.
anyway, here’s what I’m trying to use, and it makes some bizarre IPOs.
ObjectMain = "Empty" ObjectTrack = "Track" Start = 1 End = 50 from vecf import * from Blender import Object, Scene, Ipo, Window ObMain = Object.Get(ObjectMain) ObTrack = Object.Get(ObjectTrack) # Normal of the plane on which the tracking rotation occures N = vnorm(ObMain.matrix[:3]) # in this case, the Z axis def writeCurvePoint(ipo, frame, point): # ipo: the IPOblock to use frame: at what frame # point: the 3D coordinate to write xc = ipo.get('RotX') yc = ipo.get('RotY') zc = ipo.get('RotZ') idx = 0 for c in [xc,yc,zc]: c.addBezier((frame, point[idx])) idx += 1 c.update() def makeIPO(name, ipol, expol): # name: desired name for this IPOblock ipol: type of interpolation # expol: type of extrapolation ipo = Ipo.New('Object', name) xc = ipo.addCurve('RotX') yc = ipo.addCurve('RotY') zc = ipo.addCurve('RotZ') for curve in [xc, yc, zc]: curve.setInterpolation(ipol) curve.setExtrapolation(expol) return ipo scene = Scene.getCurrent() IPO = makeIPO("Track", "Linear", "Linear") for Fr in range(Start, End +1): scene.currentFrame(Fr) Window.RedrawAll() # Vector from the Tracking object to the Target AB = vecsub(ObTrack.matrix[:3], ObMain.matrix[:3]) # projection of AB on the plane of the tracking rotation T1 = vnorm(vecsub(AB,proj(AB, N))) # in this case, the Y axis T2 = vnorm(crossp(T1, N)) # in this case, the X axis Rot = mat2euler_rot([T2, T1, N]) writeCurvePoint(IPO, Fr, vecmul(Rot,18/pi)) ObMain.RotX = Rot ObMain.RotY = Rot ObMain.RotZ = Rot ObMain.link(IPO)
again, using the vecf.py module I posted the other day.
If someone could help me get the IPO part correctly, it would be close to finish.