This project is read-only.

create smooth transitions

Dec 6, 2010 at 8:16 PM

i was messing around with tutorial 11, really nice commented code and short, but i wasnt able to make a smooth transition between lets say  Wave -> Jog -> Walk -> wave again. Any help =)?

Dec 8, 2010 at 5:28 AM

Have you tried playing around with the AnimationInstance's Weighting variable?

 

What I do when I want somewhat of a transition between animations I write something like this(pseudocode). Say for this case that the character is currently walking and then I set the animation to waving.

 

Wasn't much of pseudo-code but w/e -_-

 

//######PSEUDO-CODE######

AnimationInstance m_xCurrentAnimation;

AnimationInstance m_xLastAnimation;

bool m_bAnimationTransition;

 

void init()

{

setAnimation("waving");

}

void setAnimation(string s)

{

m_xLastAnimation = m_xCurrentAnimation;

m_xCurrentAnimation = AnimationHandler.GetAnimation(s);

m_xCurrentAnimation.Weighting = 0.0f;

m_xLastAnimation.Weighting = 1.0f;

m_bAnimationTransition = true;

}

 

void Update()

{

if(m_bAnimationTransition)

{

// MaxWeight for XEN animation == 1.0

if(m_xCurrentAnimation.Weighting != MaxWeight)

{

m_xLastAnimation.Weighting -= 0.01;

m_xCurrentAnimation.Weighting += 0.01;

}

}