[Bf-committers] Building matrices from loc, size, quat

Roland Hess bf-committers@blender.org
Sun, 01 Aug 2004 13:55:53 -0400

Thanks for the function, Ton. I was getting there on my own, but you've
no doubt saved me a days work.

Indeed, I won't really be using the matrix for internals (if I
understand what you mean). The problem trying to address is that
different actions, when put together in the NLA system, can cause your
characters feet (or hands, etc.) to slide. You can see a sample
animation in this post:


Unless you design your Actions with the feet in the same place relative
to the root bones, you get undesirable results with NLA. IMO, this kills
some of the usefulness of NLA - you should be able to design your
actions freeform, put them together in NLA however you choose, and have
it look good.

What I'm working on is an addition to each NLA strip. It's called
pinBone. For each strip, you can assign a bone to be "pinned". What it
does is transforms the armature at the object level so that the
indicated pinned bone begins the strip at the same place (globally) it
was located in the previous strip. The result is that, if you choose the
bone "foot.l.acc" for your pinned bone on a particular strips, that bone
will not experience the jump (or slide if you're using blend in/out) it
normally would. You can use your actions freeform, and just tell Blender
  how you want the actions to stick together. I got the idea from
watching a demo of MotionBuilder.

Internally, what happens is that each NLA strip is given a 4x4 matrix to
hold, calculated from the difference in position of the indicated
pinBone at the beginning of the current strip, and the position of the
same bone at the end of the previous strip (modified appropriately for
Blend In/Out). Upon display (or render), the matrix for the last NLA
strip at the current frame is used to transform the armature at the
object level. The matrices are cumulative, so every time you rearrange
the NLA for a particular armature, they are recalced, and you only have
to do the object-level transform with the most "recent" one, making it
fast when you're not actually changing the NLA.

Update: got your code in, Ton. Worked great with a couple of changes. 
Thanks again.

Roland Hess - harkyman