Nate

Edit: See IK documentation! http://esotericsoftware.com/spine-using-ik

IK constraints are in Spine version 1.9.0, which is now available. :clap: It currently allows for two bone IK as well as IK/FK mixing, which can be keyed. This allows you to mix and match FK and IK within the same animations. Coupled with skinning, IK makes for extremely easy animating of meshes that deform realistically.



In the animation above, IK is used on the raptor's feet. This locks the feet to the ground and the knees and ankles adjust automatically as the body bounces up and down.

I'm going on a short vacation soon, so we did a big crunch time push to get this released before then. It works from start to finish and has a good deal of polish, but there are some minor features we will be working on in the future.

Currently none of the runtimes support IK. The IK data is also not yet output in the JSON or binary formats. We wanted to get IK in your hands as soon as possible.

If you aren't familiar with IK, it stands for inverse kinematics. IK adjusts the rotation of a hierarchy of bones so the tip of the last bone points at a specific place. Eg, you can use this to pin feet to the ground, so when your character crouches the knees bend instead of the feet going through the ground. You can also animate the target the bones point to, which can make many kinds of animation much easier and use a lot fewer keys.

To use IK in Spine, select two bones, click Constraints in the tree, add a new IK constraint, then choose a target bone. Now the two bones will always point to the target bone. You probably want to create a bone solely for the purpose of being the IK target.

You can adjust the IK/FK mixing on the constraint's properties in the tree. This allows you to use keys on your FK pose to use a mix of FK and IK. To see the FK pose, IK pose and the mix pose at the same time, check the visibility dot next to the constraint. When the visibility dot is unchecked (the default) then you will only see the mix pose and the bones are drawn as an outline to show that the scale, rotation and/or translation is being controlled by a constraint and cannot be edited.

---

1.9.01 fixes a few issues. A few more still remain, but are relatively minor. Eg, the translation axes when dragging the translate tool can be incorrect on bones controlled by an IK constraint when the constraint is visible, bone compensation can be incorrect on bones controlled by an IK constraint, etc.

I am taking a short vacation to visit family and will be unavailable for 3 weeks. Shiu is available to field your questions.
User avatar
Nate

Nate
  • Posts: 9958

mfedorov

Broken my brain (( Can you plz make a video tutorial?
User avatar
mfedorov
  • Posts: 262

Søren

https://www.youtube.com/watch?v=orqb4Hz ... e=youtu.be here you go :) It's not step by step but should help you get started.
User avatar
Søren

Shiu
  • Posts: 2410

psh7674

where is the example file?
psh7674
  • Posts: 2

Søren

There is no example file yet since the feature isn't fully complete. I will create an example scene today so you can check that out when I upload it, just keep in mind that things are likely to change slightly.

---

I've created an example project now, you can find it at http://esotericsoftware.com/files/examp ... xample.zip
There are a couple of things that will become much easier to do once we are finished with IK. The Spineboy skeleton has two animations you can check.
User avatar
Søren

Shiu
  • Posts: 2410

Vohjiin

The awesome features just keep rolling in, If there was one thing about Spine I missed from modern 3D modeling programs it was IK constraints. I notice you mention IK data not being exported out in JSON format, are there going to be options to check what data we would like exported out in JSON? skinning data, IK, FFD, Mesh? Curiosity for some runtimes that are not updated as quickly as Spine does or legacy options for outdated runtimes (if that occurs).
Vohjiin
  • Posts: 15

Søren

:)

I can't say if there will be options for what data to export since I don't know, but it's not something I've heard Nate mention. Currently if you want to use IK for animation and export it, you'll need to key the bones after IK, not ideal but it will be sorted when Nate is back from the US. The reason we wanted to release IK already is that we can then receive input from users to improve on it and also bugs will be found quicker, so in the end it means it will reach a more polished state quicker. I've certainly had a lot of fun with it already but I am already aware of a couple of things that needs sorting out.
User avatar
Søren

Shiu
  • Posts: 2410

mfedorov

Oh, Awesome! Thank you for this tutorial!
User avatar
mfedorov
  • Posts: 262

Badazdz

Pinning another skeleton would be nice. Something like this or just custom renderer, which supports own draw order.
Badazdz
  • Posts: 7

Søren

Nate already did some work on skeletons as attachments but it's not ready yet. "Just" custom renderer ;)
User avatar
Søren

Shiu
  • Posts: 2410

Badazdz

How far is he with the progress? I would be glad to see that custom renderer, though.
Badazdz
  • Posts: 7

Søren

I don't know how much work is left on it. What exactly do you mean with custom renderer?
User avatar
Søren

Shiu
  • Posts: 2410

Badazdz

I have managed to change SkeletonRenderer and SkeletonAttachment class to support custom draw order, but I ran into this problem... The pogo and that indian are two different skeletons.
img.png
You do not have the required permissions to view the files attached to this post.
Badazdz
  • Posts: 7

Søren

Should probably create a new thread to discuss custom draw order rendering. I'm afraid it's something Nate will have to give his input on since I won't be able to help you with it, I'm not a programmer by trade.
User avatar
Søren

Shiu
  • Posts: 2410

Ce11crowd

Looking great! I was wondering if Spine skeletons will be supporting IK in realtime as well, where IK targets can be positioned dynamically? As it is done in the Spine editor, I'm sure this could also be done inside a runtime?
Ce11crowd
  • Posts: 6

Søren

Thanks! Yes that is the plan, this is why we made IK only two bones since anything more takes too much processing power and it is also much easier to control. The exact details are not yet decided though.
User avatar
Søren

Shiu
  • Posts: 2410

puzzler

Is it possible to use more than 2 bones for IK?
puzzler
  • Posts: 108

Søren

puzzler wrote:Is it possible to use more than 2 bones for IK?
Hehe I answered that right above your post. But no it is not possible to use more than 2 bones for IK. We want IK to be available at runtime so it has to be lightweight. We do plan on allowing 1 bone constraints as well. But at this moment no more than 2 bones.
User avatar
Søren

Shiu
  • Posts: 2410

Nate

We'll only support 1 and 2 bone IK to start. Note you can use IK on any two bones in the hierarchy, even if there are other bones between them. Eg if you have torso, neck, head then you could do IK on torso and head if you wanted.
User avatar
Nate

Nate
  • Posts: 9958

SONIC3D

Awesome feature!Thank you!
SONIC3D
  • Posts: 7

SysOp

Terrific feature! Wet dream for animators!

ANYHOW, want to use on this new project just started. AFAIK, constraints info won't be exported, so is for now cosmetic, right?

I've heard that keying the bones that uses IK, might be a way to properly use animations at runtime. Question is: is there a easy way to do that? There will be a way to export bone rotations set by IK as bone keys, like, automatically?

What I'm doing now is kinda tedious, as i have to see fancy rotation of bones, to turn off the IK, key each one, advance in the animation... turn on IK, see position of bones, turn off IK, key bones, turn on IK, set positions, key stuff, repeat for 60 frames... :sweat:

Would be cool to automagically have this button that says 'key all bones affected by constraints, each frame" so animations can be used on all targets.
User avatar
SysOp
  • Posts: 14

Søren

It's only cosmetic now or if you export as an image sequence, this will be of course be sorted when Nate is back from vacation.
It was actually supposed to key bones based on the IK but a bug must have crept in and this does not happen currently. You can click the visibility dot next to the IK constraint in the Constraints list in the tree to see both FK and IK at the same time then move your FK bone to the IK location and key it, a little less tedious than what you're doing now.
User avatar
Søren

Shiu
  • Posts: 2410

SysOp

Thanks Shiu for the tip and info, my wolf is more happy since can be better animated now >:D

User avatar
SysOp
  • Posts: 14

Søren

Cool, I see you are doing something a bit like a standard footroll setup. We'll make it possible to only use a single bone that is constrained and then you can disable rotation inheritance on the toe bone which will then give really nice control over the foot
User avatar
Søren

Shiu
  • Posts: 2410

FSG

When can i see the t-rax example? not the example boy.
FSG
  • Posts: 3


Return to Editor