- Home /
Mecanim Blend Tree: transition not smooth
Hi, I have an issue regarding the blend tree I have created.
The blend tree I created consists of a running animation and a "Shoot while running" animation for a humanoid character I modeled.
My intention is when I click the "t" button while holding down the right button(running animation), the character should transit from the running animation to the "Shoot while running" animation.
However, the solution I came up with was using the script to change the float value. Here is an example of my code:
if (currentBaseState.nameHash == locoState) //Blend Tree
{
if(Input.GetKey(KeyCode.T))
{
anim.SetFloat ("Running" , 1);
}
else if (!Input.GetKey(KeyCode.T))
{
anim.SetFloat ("Running" , 0);
}
}
Everything worked fine but the transition wasn't smooth, in fact, there is no real "blending" of the animations. I understand this may not be the correct workflow for the blend tree and thus I would like to understand if there are any other way I could work around it?
Answer by meat5000 · Sep 20, 2013 at 08:40 AM
For real blending you need to add an upper body only animation for shooting and put it in a higher layer in the state machine. Make sure its additive, then you blend by adjusting the weight. You can also create a bodymask to select particular bones to use/ignore.
Your answer
Follow this Question
Related Questions
Combining two animations to be one 0 Answers
Mecanim Root Motion Rotation - 180 degree turn. 2 Answers
Mecanim transition between animation help 0 Answers
Mecanim mysterious curve 2 Answers