• Unity
  • Stuck on Transform and IK stacking.

  • Изменено
Related Discussions
...

Hello,

I am still having an issue where my character doesn't apply his transforms in the order I desire.

In fact, I have two conflicting contexts:

One, where I want the IK to apply before the Transform constraint.
Another, where I want the transform constraint to apply, then the IK.

Pharan's most recent skeletal ordering stab made it work for one of my characters and broke another one.

What can we do here?

-Alex


18 Jul 2016, 14:27


I spent about four hours trying to understand how the update ordering is done in Skeleton.cs and tweaking it to 'auto detect' the scenarios included, but I didn't have any luck with this.

Sorry I'm late. The skeleton update order is a relatively complex beast, sorry you dived in there!

This issue explains the problem:
Support applying IK after other constraints · Issue #62 · EsotericSoftware/spine-editor · GitHub

Once we solve that (not the easiest feat) we can provide user supplied update order, eg maybe by dragging to reorder constraints in the tree.

BTW, you can see all our public project management issues on our editor and runtime waffles:
https://waffle.io/EsotericSoftware/spine-editor
https://waffle.io/EsotericSoftware/spine-runtimes

That would be wonderful. Is there anything I can do to be of assistance?

If you want to look at the problem yourself, compare how an IK constraint is applied (the math looks crazy, and it is, but step through and you'll see most of it can be ignored for the common cases) versus a transform (much simpler to look at) or a path constraint. Path and transform constraints work solely on the world values (bone matrix and world position), they don't use the local values. IK constraint uses both the local and world values. Now consider:

1) Apply a transform constraint. The bone matrix and world position is adjusted.
2) Apply an IK constraint. First, it uses local transform values, so won't see changes the transform constraint made. Second, after finding the IK solution, it does updateWorldTransform to compute a new bone matrix and world position, which will overwrite the transform constraint changes.

Solving this means either:

1) Transform and path constraints need to work by adjusting local values rather than world values. This is difficult because these constraints really do manipulate world values, so their manipulations would have to be mapped to local values, which can be ambiguous. See updateLocalTransform for what that might look like.
OR
2) IK needs to work without using local values. This is difficult because IK needs to translate the child and target bones into local space to do the IK solving, however this is probably the most sane solution.

If the solution involves extra work, possibly we can find a way to avoid that work when it isn't needed.