WEBVTT

1
00:00:00.010 --> 00:00:06.180
Inverse kinematics, or IK, is one of the most common bone constraints, as it helps make

2
00:00:06.180 --> 00:00:10.960
moving limbs and other joints very intuitive and easy to animate.

3
00:00:10.960 --> 00:00:12.560
But what is IK?

4
00:00:12.560 --> 00:00:19.400
Well, inverse kinematics is the opposite, or inverse, of forward kinematics, or FK.

5
00:00:19.400 --> 00:00:22.600
So let's figure out what FK is first.

6
00:00:22.600 --> 00:00:26.860
To do this, I'm going to demonstrate using a simple arm rig.

7
00:00:26.860 --> 00:00:30.940
You can find this base arm rig in the same character mesh file available in the description

8
00:00:30.940 --> 00:00:35.540
down below in the collection called arm base rig.

9
00:00:35.540 --> 00:00:38.700
Now let's talk about what exactly FK is.

10
00:00:38.700 --> 00:00:43.600
FK is simply how bone parent chains work by default.

11
00:00:43.600 --> 00:00:47.240
In other words, moving the parent moves the child.

12
00:00:47.240 --> 00:00:51.420
The reason why it's called forward kinematics is because the transformation of the bones

13
00:00:51.420 --> 00:00:56.580
only influences bones that are further forward down the chain of bones.

14
00:00:56.580 --> 00:00:57.580
Which way is forward?

15
00:00:57.580 --> 00:01:01.980
Well, if you pretend the tails of the bones are like arrows, then forward down the chain

16
00:01:01.980 --> 00:01:05.140
is simply the direction the bones are pointing.

17
00:01:05.140 --> 00:01:09.740
You can also see that moving the child right now will not affect the parent at all.

18
00:01:09.740 --> 00:01:13.100
Great, now we know what forward kinematics is.

19
00:01:13.100 --> 00:01:15.620
So what is inverse kinematics?

20
00:01:15.620 --> 00:01:19.420
Well, we know it's the opposite, but what does that mean?

21
00:01:19.420 --> 00:01:24.460
Well, instead of influencing bones forward down the chain, inverse kinematics allows

22
00:01:24.460 --> 00:01:28.580
for the transformation of a bone near the end of a chain to influence bones that are

23
00:01:28.580 --> 00:01:31.380
further up the chain of bones.

24
00:01:31.380 --> 00:01:36.020
Basically it's when a child bone has influence over the parent bone in some way.

25
00:01:36.020 --> 00:01:39.980
To demonstrate this, I want to quickly show you the auto IK option.

26
00:01:39.980 --> 00:01:45.220
Let's open the right hand side menu by pressing N or clicking this arrow here.

27
00:01:45.220 --> 00:01:49.260
Then go to tool and you'll see the auto IK option.

28
00:01:49.260 --> 00:01:52.860
This is a simple checkbox Blender has that doesn't permanently change your armature at

29
00:01:52.860 --> 00:01:56.980
all but rather helps when you want to pose bones very quickly.

30
00:01:56.980 --> 00:02:01.740
By enabling this, you can very easily move bones at the end of chains to influence the

31
00:02:01.740 --> 00:02:05.080
transformation of the entire chain itself.

32
00:02:05.080 --> 00:02:08.900
This is especially handy when animating hands or feet.

33
00:02:08.900 --> 00:02:13.540
In real life, when we raise our hands, we don't think, oh, I'll move my upper arm and

34
00:02:13.540 --> 00:02:17.860
then extend my forearm quickly so that it allows my hand to travel upwards.

35
00:02:17.860 --> 00:02:23.460
No, we tell our hands to move upwards and our upper arm and forearm act accordingly

36
00:02:23.460 --> 00:02:25.740
to accomplish that movement.

37
00:02:25.740 --> 00:02:30.460
It's this kind of natural thinking that IK allows for animators to do with their rigs.

38
00:02:30.460 --> 00:02:35.820
With IK, by simply telling the hand bone to move upwards, the upper arm and forearm bones

39
00:02:35.820 --> 00:02:40.180
will automatically determine where they have to be to accomplish that movement.

40
00:02:40.180 --> 00:02:45.820
Likewise, it's also very helpful for making sure feet stay glued to the ground when needed.

41
00:02:45.980 --> 00:02:52.300
Great, now that we understand what IK is, let's figure out how to apply it to our rigs.

42
00:02:52.300 --> 00:02:57.860
The auto IK feature is nice for quick posing, but it doesn't give us full control over the

43
00:02:57.860 --> 00:03:01.460
IK and it doesn't work for animation.

44
00:03:01.460 --> 00:03:06.140
So instead, what we want to do is use the inverse kinematics bone constraint to set

45
00:03:06.140 --> 00:03:07.760
it up properly.

46
00:03:07.760 --> 00:03:09.660
The first step is simple.

47
00:03:09.660 --> 00:03:15.780
Let's go into pose mode, select our forearm bone and add the inverse kinematics bone constraint

48
00:03:15.780 --> 00:03:20.820
from the bone constraints tab indicated by this wrapped blue bone icon in the properties

49
00:03:20.820 --> 00:03:22.380
editor.

50
00:03:22.380 --> 00:03:26.220
From there, you'll notice that we have a few input fields to fill.

51
00:03:26.220 --> 00:03:31.300
The target object will be the armature itself, even though what we really want is to target

52
00:03:31.300 --> 00:03:38.260
a specific bone, but that's within that armature, so let's select armature from the dropdown.

53
00:03:38.260 --> 00:03:41.660
Then we can select the bone we want in the bone input field.

54
00:03:41.660 --> 00:03:45.940
This works in a similar way to the track 2 and stretch 2 constraints, where our target

55
00:03:45.940 --> 00:03:49.400
bone is where we want our active bone to point to.

56
00:03:49.400 --> 00:03:52.660
So in this case, we'll want to choose the hand bone.

57
00:03:52.660 --> 00:03:57.280
However, when we select our hand bone now and try to move it, it doesn't actually seem

58
00:03:57.280 --> 00:03:59.020
to do anything.

59
00:03:59.020 --> 00:04:04.320
In fact, it's not translating at all as it's still connected to the forearm bone.

60
00:04:04.320 --> 00:04:09.200
Let's simply go into edit mode and disconnect our hand bone from the forearm bone, but keep

61
00:04:09.200 --> 00:04:10.820
it parented.

62
00:04:10.820 --> 00:04:15.900
Now as you can see, we can translate our hand bone and it influences the forearm bone,

63
00:04:15.900 --> 00:04:19.760
but it also influences the entire rig.

64
00:04:19.760 --> 00:04:23.920
This is not what we want, we only want the arm to bend, so let's go into our inverse

65
00:04:23.920 --> 00:04:28.340
kinematics bone constraint and go to our chain length option.

66
00:04:28.340 --> 00:04:33.580
The default is 0, and this simply goes up the entire bone chain the active bone is parented

67
00:04:33.580 --> 00:04:34.740
to.

68
00:04:34.740 --> 00:04:38.940
So in our case, it goes all the way down to the bottom of the spine.

69
00:04:38.940 --> 00:04:42.200
This is indicated by the yellow dotted line here.

70
00:04:42.200 --> 00:04:47.200
By changing the chain length value, our yellow dotted line will show how far up the chain

71
00:04:47.200 --> 00:04:49.880
our inverse kinematics will take effect.

72
00:04:49.880 --> 00:04:52.760
You might see a bit better in wireframe mode.

73
00:04:52.760 --> 00:04:57.820
However, the only bones we want influenced by the inverse kinematics constraint are the

74
00:04:57.820 --> 00:05:00.520
forearm and upper arm bones.

75
00:05:00.520 --> 00:05:03.600
So we want a chain length of 2.

76
00:05:03.600 --> 00:05:10.200
Now when we move our hand bone, it correctly influences only the forearm and upper arm.

77
00:05:10.200 --> 00:05:13.500
But I don't think we want it to be freaking out like this.

78
00:05:13.500 --> 00:05:19.100
It doesn't seem like it's very animatable or stable, so what's happening here?

79
00:05:19.100 --> 00:05:24.260
Well quite simply, remember in the parenting video when I said you can't form a loop in

80
00:05:24.260 --> 00:05:25.740
the parents?

81
00:05:25.740 --> 00:05:28.140
Well we sort of just did here.

82
00:05:28.140 --> 00:05:33.580
If you think about it, the forearm is pointing to the hand, but the hand is parented to the

83
00:05:33.580 --> 00:05:35.000
forearm.

84
00:05:35.000 --> 00:05:40.160
This means that when the hand moves, the forearm will try to point to the hand.

85
00:05:40.160 --> 00:05:45.960
But if the forearm moves to point to the hand, the hand will have to move because it's parented

86
00:05:45.960 --> 00:05:51.180
to the forearm, thus moving the hand further, which will move the forearm further to point

87
00:05:51.180 --> 00:05:55.040
to the hand, which will move the hand further because it's parented, which will move the

88
00:05:55.040 --> 00:05:58.520
forearm to point to the hand, etc. etc.

89
00:05:58.520 --> 00:06:02.740
This is called a cyclic dependency, and we don't want that.

90
00:06:02.740 --> 00:06:07.980
So let's go ahead and unparent the hand entirely so that we can move our hand independently

91
00:06:07.980 --> 00:06:09.380
from our forearm.

92
00:06:09.380 --> 00:06:15.080
Nice, as you can see, moving our hand now bends the elbow in a very natural way.

93
00:06:15.080 --> 00:06:19.900
The only issue we have now is because the hand is no longer connected to the forearm,

94
00:06:19.900 --> 00:06:25.080
we can now stretch the hand out away from the forearm, which isn't ideal.

95
00:06:25.080 --> 00:06:29.460
So the most common workaround for this is to simply go back into edit mode, re-parent

96
00:06:29.460 --> 00:06:34.700
the hand to the forearm, then duplicate the hand bone and unparent the duplicate.

97
00:06:34.700 --> 00:06:38.980
Now we have an independent controller bone that we can point to instead.

98
00:06:38.980 --> 00:06:42.380
Let's call this bone hand underscore ik.

99
00:06:42.380 --> 00:06:47.660
Going back into pose mode, we can select our forearm, go into the bone constraints tab,

100
00:06:47.660 --> 00:06:51.980
and change the bone target from hand to hand ik.

101
00:06:51.980 --> 00:06:57.740
Now as we move our hand ik bone, the forearm and upper arm deform nicely, and we can move

102
00:06:57.740 --> 00:07:01.860
this hand ik controller out without stretching the hand itself.

103
00:07:01.860 --> 00:07:06.420
However, now to rotate the hand bone itself, we would have to switch between animating the

104
00:07:06.420 --> 00:07:10.140
hand ik and the original hand bone.

105
00:07:10.140 --> 00:07:14.860
That's a bit tedious for our animators, so let's add a simple copy rotation constraint

106
00:07:14.860 --> 00:07:20.880
for the original hand deformation bone to follow the hand ik bone for easy animation.

107
00:07:20.880 --> 00:07:26.460
I'm also going to make the hand ik bone a bit bigger in edit mode, so it's easier to differentiate

108
00:07:26.460 --> 00:07:31.420
from the original hand bone, although giving it a nice custom bone shape is an option as

109
00:07:31.420 --> 00:07:32.420
well.

110
00:07:32.420 --> 00:07:36.220
Great, now we have a nice basic ik rig.

111
00:07:36.220 --> 00:07:40.740
Except, you may notice that sometimes when we move the hand bone around, the elbow sort

112
00:07:40.740 --> 00:07:43.040
of bends the wrong way.

113
00:07:43.040 --> 00:07:47.600
This is not ideal, and some of you may remember that there is still one more input field in

114
00:07:47.600 --> 00:07:50.300
our inverse kinematics constraint.

115
00:07:50.300 --> 00:07:53.020
Let's go back into it and see what it is.

116
00:07:53.020 --> 00:07:56.380
Yes, the pole target input field.

117
00:07:56.380 --> 00:08:00.300
This will be helpful for solving the issue of joints bending the wrong way during inverse

118
00:08:00.300 --> 00:08:01.700
kinematics.

119
00:08:01.700 --> 00:08:07.380
A pole target is simply a reference object or bone that the elbow joint or inverse kinematics

120
00:08:07.380 --> 00:08:11.060
joint will try to point to as the bones bend.

121
00:08:11.060 --> 00:08:15.740
For this, we can simply create a new bone by duplicating the hand ik bone and moving

122
00:08:15.740 --> 00:08:17.260
it behind the elbow.

123
00:08:17.260 --> 00:08:22.220
I'm going to rotate it so that it points away, but it doesn't matter because only its location

124
00:08:22.220 --> 00:08:23.980
is actually referenced.

125
00:08:23.980 --> 00:08:27.540
Let's rename this to elbow underscore target.

126
00:08:27.540 --> 00:08:32.300
Now we can go back into our inverse kinematics constraint settings and simply input the armature

127
00:08:32.300 --> 00:08:34.580
again for the object field.

128
00:08:34.580 --> 00:08:39.540
For the bone input, we'll want to select elbow underscore target.

129
00:08:39.540 --> 00:08:44.620
And now, as you can see, when we move our hand ik bone, the elbow never bends in the

130
00:08:44.620 --> 00:08:47.500
wrong direction anymore.

131
00:08:47.500 --> 00:08:50.460
Except that's because the elbow doesn't bend at all.

132
00:08:50.460 --> 00:08:54.780
This is because, quite simply, our bones were created too straight and it doesn't

133
00:08:54.780 --> 00:08:57.400
know which direction to start bending.

134
00:08:57.400 --> 00:09:03.460
So let's very quickly go into edit mode and just drag our elbow joint slightly backwards.

135
00:09:03.460 --> 00:09:07.020
Now as you can see, our elbows bend just fine.

136
00:09:07.020 --> 00:09:08.720
Except it's still in the wrong direction.

137
00:09:08.720 --> 00:09:12.940
But don't worry, that's because we forgot to set one more value in the inverse kinematics

138
00:09:12.940 --> 00:09:14.520
constraint.

139
00:09:14.520 --> 00:09:19.900
Let's go ahead and keep our elbow bent and then select our forearm bone again.

140
00:09:19.900 --> 00:09:24.700
We can go into the inverse kinematics constraint and click and drag this pull angle value

141
00:09:24.700 --> 00:09:27.940
until it points to the pull target correctly.

142
00:09:27.940 --> 00:09:28.940
And that's it!

143
00:09:28.940 --> 00:09:32.380
We now have a working inverse kinematics rig in Blender.

