RemDust

Hello guys,
This has been a tough subject for me for a long time now ^^

When animating attacks with weapon (swords etc) I often end up with a frame in which my hand IK and my weapon are far "behind the player" (think of a sword slash final frame and pose).
The next animation frame is often very different and the IK and weapons are far from the slash position.

It results in weird mixing in Unity (with the IK taking the "shortest path to the next IK position, and the weapons circling weirdly to the new position). I know that I could just set the mix for this specifics transitions to 0 but then it looks very harsh compares to the other animations.

I was wondering if there is any commun ways of dealing with these situations ?
Also, is there a way to prevent mixing ONLY for certain bones ? (the arm and weapon could snap back to position but allow the body head and other bones to mix)

Thanks ! :)
RemDust
  • Postovi: 223

Harald

Could you please post any screenshots or a short video that shows the current behaviour that you are facing? Otherwise we might think of a different situation and try to solve problems that you don't even have :).
Avatar
Harald

Harri
  • Postovi: 3924

RemDust

Hey Harald,
Sure, here you are.

The 2 poses in Spine looks like this :
1 is the final frame of the attack
2 is the first of the next animation (here, idle)



And here is the mixing in Unity



You can clearly see the weapon circling under the player towards the idle position, which I haven't screened to keep it light, the frame is perfectly the same as it is designed
(You can also see the weapon mixing the scale back to (1,1) xD )

The Spine Unity Mixing is currently on 0.2, manually setting this transition to 0.1 reduces the effect but it's still visible, obviously zero results in a strong "snap back" of the whole skeleton. I was hoping to maybe mix the body and not the weapon...

I hope this is all clearer now :)
RemDust
  • Postovi: 223

Harald

Thanks for posting the additional screenshots, they explain the situation very nicely!
RemDust je napisao/la:I was wondering if there is any commun ways of dealing with these situations ?
One common solution for such a problem would be to create a very short transition animation which is played between both animations. This way the straight linear interpolation that happens when mixing from A to B can be replaced with a custom one.
RemDust je napisao/la:Also, is there a way to prevent mixing ONLY for certain bones ? (the arm and weapon could snap back to position but allow the body head and other bones to mix)
I'm afraid there is no way to limit mixing to certain bones, or to have custom mix settings per bone. If you want to achieve separate different mixing, you would need to split the animation into e.g. separate body and arms animations.

I am just a mere programmer though, so there might be solutions out there that I have not considered. :nerd:
Avatar
Harald

Harri
  • Postovi: 3924

RemDust

One common solution for such a problem would be to create a very short transition animation which is played between both animations. This way the straight linear interpolation that happens when mixing from A to B can be replaced with a custom one.
That makes sense, I think I'm gonna go with that solution !
If you want to achieve separate different mixing, you would need to split the animation into e.g. separate body and arms animations.
That sounds like a clever hack ^^
Can you confirm that both animations would end at the exact same time though ?
I mean if AnimationArms and AnimationBody are the same length in editor, then both played simultaneously in unity (but Arms have 0 mixing time and Body does have one) would the next animation starts at the exact same moment ?

I could give it a try but I suppose the first solution would give better result, obviously
RemDust
  • Postovi: 223

Harald

RemDust je napisao/la:Can you confirm that both animations would end at the exact same time though ?
I mean if AnimationArms and AnimationBody are the same length in editor, then both played simultaneously in unity (but Arms have 0 mixing time and Body does have one) would the next animation starts at the exact same moment ?
Mix duration will offset the start of your animation differently if you call AddAnimation() with a delay of <= 0 (aligning the end of the animation mix transition), as the documentation states. Also see the documentation of TrackEntry.MixDuration.

If you use SetAnimation() or AddAnimation() with delay > 0, or set TrackEntry.delay afterwards to the same value at both animations, your new animations will start at the same time (which is determined by TrackEntry.delay).
Avatar
Harald

Harri
  • Postovi: 3924

RemDust

Thank for this detailed answer Harald :)
RemDust
  • Postovi: 223

Harald

Glad it helped. :) In general, it will always help to check the API Reference page first regarding any qustions in behaviour.
Avatar
Harald

Harri
  • Postovi: 3924

tjbrunetto

Remdust,

Can you confirm that the transition from the final slash, to idle filler, to idle ended up working for you?

Tim
tjbrunetto
  • Postovi: 139


Natrag na Unity