Reset to bind pose?

For some reason I play animation ‘idle’ then play animation ‘attack’ and when I go back to playing animation ‘idle’ the character has retained some transformations from the ‘attack’ animation … it seems to be the last pose the character was in gets added as an offset?

What am I missing… how do I reset the object back to it’s bind pose or make sure that other animations are ‘really’ stopped? Is this a bug?

So I found that if a bone is animated in one animation (i.e. attack) but not in another (i.e. idle) it will retain the last pose from attack when switching from attack to idle.

This is a problem. I guess I’m asking for a ‘resetToBindPose’ which I guess doesn’t exist.

SO is therefore the only solution (i.e. hack) to create a custom ‘bindPose’ animation and play this when wishing to return to bindPose?

It’s a shame because the bind pose is stored in the mesh no? So why so hard to return to it?

Oh well.

I think it’s less of a problem and more a reminder that you forgot to animate something. A living creature is rarely if ever truly not moving.

All poses affect bones; not the mesh. The mesh stores no animation information ('cept bone weights), that’s all in the bones.

What you can do is something like:

// beware that these pragmas can lead to well-hidden bugs if you're not careful
#pragma implicit
#pragma downcast // dunno if this is necessary, prolly not.

var defaultBoneStuff : Hashtable;

function Start() {
  defaultBoneStuff = new Hashtable();
 // record default positions  rotations of all child objects, indexed by their name
 // might try indexing by the actual transform, which ~might~ work better.
  for ( var t : Transform in transform ) {
    defaultBoneStuff.Add( t.name, new Array( t.localPosition, t.localRotation ) );
  }
}

function SetBindPose( bones : Array ) { // array of bone transforms to reset
  // with some finagling this could be rewritten to accept names of bones; it'd be slower though.
  for ( var b in bones ) {
    var boneInfo : Array = defaultBoneStuff[ b.name ];
    b.localPosition = boneInfo[0];
    b.localRotation = boneInfo[1];
  }
}

Stick that on whatever is the parent of all the bones, and call SetBindPose with a list of bone transforms that need to reset.

There’s lots of room for improvement in that code, but it should be somewhat helpful at least. :slight_smile:

1 Like