• Editor
  • IK bend mode mix (between Positive & Negative)

Hello everyone,

First of thank you for making this amazing software !

I have a question that might be a feature request :
Is there a built-in way in Spine to mix between positive and negative IK mode ?
All I see is a checkbox, and it makes abrupt transitions between animations (be it in editor or runtime with Unity).

I found a workaround (involving making another set of bones with the opposite IK constraint, plus a transform constraint to copy rotations with which I mix from first set of bones to second) which works nice (although it breaks a little bit the IK during transition, but it's still better than before).

The only problem is that I'm doing this quite often now and I wondered if it could be a nice feature : to have a mix slider instead of the checkbox and let the engine do the solution I mentioned.
What do you think ?

Thank you for your time 🙂
Galaad

Related Discussions
...

It's an interesting idea to have "bend direction" as a slider. FWIW, the need for this hasn't come up before. We'd have to solve the IK twice, then interpolate between the rotations. When doing that, there are two ways the bones can go around so we choose the shortest rotation. This can be a bit wonky, eg see rotate mix on a transform constraint.

The transform constraint workaround is OK, though I expect a bit messy. It may work exactly like a bend slider, I'm not sure without seeing it firsthand.

Depending on your needs, you might be able to straighten the IK bones so when you change the bend direction it isn't noticeable.

Thanks for you reply !

Here is the dirty workaround in action :

As you can see it goes pas the IK a little bit, but I guess it's ok for me.

What did you mean by "you might be able to straighten the IK bones" ?
Like stretch them so they don't overshoot that way ?

Oh, and one last thing : When I mix up my transform constraints to mimic the bones with the opposite bend mode, I also have to mix down the first IK, but it breaks if I mix it to 0/100 (it disables my second transform constraint), so I just mix it to 1/100 instead ... Messy again ...
Do you think it's normal ? 🙂

Galaad Moutoz wrote

What did you mean by "you might be able to straighten the IK bones" ?

Move the IK target out of range so the bones are straight. Then when you change the bend direction, the bones won't move.

Galaad Moutoz wrote

When I mix up my transform constraints to mimic the bones with the opposite bend mode, I also have to mix down the first IK, but it breaks if I mix it to 0/100 (it disables my second transform constraint), so I just mix it to 1/100 instead

I'm not sure without seeing it. Could it be your constraint order that is the problem? I can take a look if you post or email a project, plus instructions for where to look. contact@esotericsoftware.com

4 months later

I have a related question that may solve this:
Why can't you just get rid of the checkbox and allow mix values of as low as -100?

If I understand correctly, this would give the OP's desired effect so long as the bones in the IK were in the "straight" position (chained and same angle) when the IK mix was 0.

Negative IK mix isn't the same thing as bending the other way. If black is the FK rotation and green is the IK rotation, red would be -100% mix:

Image removed due to the lack of support for HTTPS. | Show Anyway

Couldn't it be used to achieve the same result the OP aimed for though?
.01% though 100% would act like the current implementation does with .01%-100% and the "positive" box checked.
-.01% through -100% would act like the current implementation does with .01%-100% and the "positive" box NOT checked.
It would just make switching between positive and negative IK settings smoothly much simpler.
And for a limb that needs to bend with an IK one way and then bend with an IK the other way, you have the child IK bone's location at the tip of the parent and set the parent and child bones to have the same angle when the IK mix is 0.
Then you put the position the IK target where you want it, key it, put it where you want it one the "other side" the limb needs to bend with -100% mix, key it, and you're done. This would make switching positive and negative IK's much simpler to do nicely at run time.

Ah, I see your suggestion is to use the mix sign to indicate bend direction. This is sort of overloading the mix, since bend direction and mix are pretty separate functionality. I think it's not super common to have an IK like in your project, and the workaround is pretty straightforward: mix 100 to 0, change bend direction, mix 0 to 100. It's probably not worth the trouble of changing the checkbox to mix sign and I like the clarity of having them separate.

Realy?
Just my opinion, but it seems somewhat unintuitive to have the positive/negative checkbox, especially with transform constraints allowing negative mix percentages already.
To clarify how to get negative bending, you could also have 0 mix in the center of the slider, with negative to the left and positive to the right (like transform constraint offset sliders are).
I also can't think of any situation in which you'd want to use the current checkbox to key a switch in bend direction when the mix isn't zero, because it would never be smooth.

Not all transitions need to be smooth, but the main point is that bend direction is unrelated to mix. Negative mix is not useful, as shown in my image above. We could discard the sign of the mix for the actual IK mix and flip the bend direction when the mix is negative, but this is overloading the mix to do two tasks.