While college was on I hardly had any time at all to work on this. I found a spare three hours this morning and implemented 'controllers'. Currently you can instruct the boids to follow or to be attracted/repelled/directed by controllers. I also implemented a way of detecting the orientation of the ground plane from the cross product of the last two direction vectors (with necessary error checking, direction flipping etc) and replaced all of the orientation interpolation code with quaternion slerp. This will obviously need some more careful coding to make sure that the boids don't suffer from quaternion flip - hopefully I can get the smooth interpolations of quats with the twistability of eulers (i.e. >360 degree angles).
I've also been messing with low-poly stuff seeing as that seems to be in vogue this year what with 'Between Bears' rocketing up the vimeo charts. After walking in the woods this evening in low light I was trying to work out how to get the sense of a curved ground plane from only the striation of the tree trunks. Kept running into anti-aliasing issues though - the opposite type from usual - smooth fades from black to white wasn't quite what I had in mind.
Sometimes my poses are just too strong and the animation ends up being very exaggerated and hard to follow, and sometimes they're too weak and need amplifying. Joshua Leung's new push and relax features for pose bones in blender do a great job of handling in betweens and making them more or less similar to the neighbouring keys. Often I find that before I even get to the inbetweening phase of animation I want to edit my key poses in a similar manner. Especially with the spine and neck I want to be able to relax the bone's locations and rotations towards the rest pose (the same way I would smooth vertices when I'm modelling). Here are two more python scripts I threw together this morning while working on another walk cycle...
Smooth Pose
import bpy,mathutils
amount=0.05
a=mathutils.Quaternion((1,0,0,0)) for each_bone in bpy.context.selected_pose_bones: each_bone.location=each_bone.location*(1-amount) if each_bone.rotation_mode=='QUATERNION': each_bone.rotation_quaternion=each_bone.rotation_quaternion*(1-amount)+(amount*a) elif each_bone.rotation_mode!='AXIS_ANGLE': each_bone.rotation_euler[0]=each_bone.rotation_euler[0]*(1-amount) each_bone.rotation_euler[1]=each_bone.rotation_euler[1]*(1-amount) each_bone.rotation_euler[2]=each_bone.rotation_euler[2]*(1-amount)
Exaggerate Pose
import bpy,mathutils
amount=0.05
a=mathutils.Quaternion((1,0,0,0)) for each_bone in bpy.context.selected_pose_bones: each_bone.location=each_bone.location*(1+amount) if each_bone.rotation_mode=='QUATERNION': each_bone.rotation_quaternion=each_bone.rotation_quaternion*(1-amount)-(amount*a) elif each_bone.rotation_mode!='AXIS_ANGLE': each_bone.rotation_euler[0]=each_bone.rotation_euler[0]*(1+amount) each_bone.rotation_euler[1]=each_bone.rotation_euler[1]*(1+amount) each_bone.rotation_euler[2]=each_bone.rotation_euler[2]*(1+amount)
At the moment the scripts only support quaternions and eulers as that's all I use in my rigs. If you're an axis angle person please enlighten me as to what on earth its for! Here's the walk cycle (crits welcome):
On another note I started hacking away at blender's source code last night trying to code smoother deforms for b-bones, which in my opinion look great until you turn on mesh display when it somehow manages to fold up the mesh in all sorts of nasty ways if you're using it for something wide (like a torso) rather than something skinny (like an arm). While I haven't made much useful progress yet (other than beginning to understand the built in math libraries) I did stumble upon this very nice explanation of matrices, vectors and coordinate systems which I wish I'd found ages ago when I started diving into python in blender.