Disabling Animation Blending

Problems building or running the engine, queries about how to use features etc.
HTAPAWASO
Gnoblar
Posts: 16
Joined: Tue Jul 02, 2013 2:15 pm

Disabling Animation Blending

Post by HTAPAWASO »

This is probably a very simple issue.

I made a mesh (with skeleton and animations) in Blender and exported it into Ogre. Each animation looks fine when it's the first one run, but if I run different ones in succession they blend together and look bizarre.
For example, if I run my /walk/ animation and then my /idle/ animation, the legs will stay in the walk position when they should be straight and still.

I'm changing animation with this line:
currentAnimationState = ent->getAnimationState("Walk");

I have tried adding this line before it:
ent->getSkeleton()->reset(true);
Which makes no visible difference.

I have tried playing with:
ent->getSkeleton()->setBlendMode(Ogre::ANIMBLEND_AVERAGE);
and ANIMBLEND_CUMULATIVE, both of which don't seem to make much difference to me.

What am I missing?
Thanks.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: Disabling Animation Blending

Post by Kojack »

HTAPAWASO wrote: I'm changing animation with this line:
currentAnimationState = ent->getAnimationState("Walk");
That doesn't change animation, it just gives you the walk animation without disabling any other active animations. Every active animation (whether you are adding time to it or not) is blended together.
To stop an animation having an effect, you need to call currentAnimationState->setEnabled(false);
HTAPAWASO
Gnoblar
Posts: 16
Joined: Tue Jul 02, 2013 2:15 pm

Re: Disabling Animation Blending

Post by HTAPAWASO »

Kojack wrote:
HTAPAWASO wrote: I'm changing animation with this line:
currentAnimationState = ent->getAnimationState("Walk");
That doesn't change animation, it just gives you the walk animation without disabling any other active animations. Every active animation (whether you are adding time to it or not) is blended together.
To stop an animation having an effect, you need to call currentAnimationState->setEnabled(false);

Excellent, thank you.

Obvious now that I think about it.