Problems blending skeletal animations

jchmack

17-11-2007 13:53:24

I Am having a lot of problems with blending skeletal animations. Each animation works fine on its own but once i start to blend things start to go haywire. I made a testing app to see what the problem is.

i create a character:

TestCharacterNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("TestCharacterNode");
TestCharacterEntity = mSceneMgr->createEntity("TestCharacterEntity","MercSkeletal.mesh");
TestCharacterNode->attachObject(TestCharacterEntity);
TestCharacterNode->setPosition(0,1.55,0);



i set its animation:


TestCharacterAnimationState = TestCharacterEntity->getAnimationState("Idle");
TestCharacterAnimationState->setEnabled( true );



and i interpolate the animaitons weight over and over between 1 and zero every 10 seconds:


void FrameStarted(float Time)
{
static bool Up = true;
static float Weight = 0;
if(Up==true)
Weight+= Time/10;
else
Weight-= Time/10;

if(Weight > 1)
{
Up = false;
Weight = 1;
}
if(Weight < 0)
{
Up = true;
Weight = 0;
}
TestCharacterAnimationState->setWeight(Weight);

}


with the prepackaged ogre meshes (jaiqua/robot) the blending goes smoothly. The character interpolates between its rigged state and the first frame of the animation i chose (idle in this case). But if i do this with a mesh exported from oFusion my character doesn't take the shortest path between the two. It twists (A LOT!). At the ends (setWeight(0) and setWeight(1)) the character looks normal but in between it seems that each bone is 180 degrees off.

this is basically all of my debugging app. I am not doing any animations when the twisting occurs... only blending. I can see a few possibilities:
1) i somehow have my character all twisted in max before i export
2) ofusion might export my data incorrectly
3) ogre might be interpreting the data wrong (but if so why do the prepackaged meshes work fine?).

I am using:
oFusion_ce_1.86.
Ogre Version 1.4.0RC2 (Eihort)

thank you very much for any help.

Lioric

20-11-2007 14:48:44

This was fixed in a previous Eihort update

Make sure you are using the latest CE version

Search the Ogre forums for the animation blend fix, if you cant update your Ogre engine version, you can apply the patch to solve this in your project