• Unity
  • Disabling Tweening Possible?

Related Discussions
...

[SOLVED]

Problem:
Is there a way to remove tweening in bones at start of a certain animation? I have a main characters run animation and hit animation and while in normal situation I want bones to tween when changing for instance from running into idle, I don't want to do this always. For instance when character hits I don't want her arm to first tween into starting keyframe of the hit animation but I want the bones of the arm instantly start from certain coordinates + scale every time the hit animation is played.

Solution:
Apparently clearing up the currently playing track right before applying the next animation is a solution to this problem. Here's the function I used to achieve solution:

void ForceAnimation(SkeletonAnimation anim, int layer, string name, bool trueornot, float timeScale)
{
   if(name == currentAnimation)
      return;
   
anim.timeScale = timeScale; anim.state.ClearTrack(0); anim.state.SetAnimation(layer, name, trueornot); currentAnimation = name; }

If you select your SkeletonData asset, you can set pairs of animations and the transition/mix duration between them. You can set the transition/mix duration to 0. Otherwise, it will follow whatever is in its Default Mix field.

Oh, amazing how I have missed that! Thanks @Pharan 🙂

As a future reference to anyone who might have similar problem I uploaded path to adding the mix as an attachment.

Thanks for sharing that image! I'm glad it worked for you.