Now we are going to create a stretchy leg. If you notice the foot_anim can't go past a certain point before having the leg not follow.
We are going to fix this by creating a stretchy leg.
STEP 1: Theory
So to make this work we need to think about what really happens. This is important to understand what we are going to do.
We need to know when the leg goes into hyper extention. If you recall the translateX should tell us how long the bone is.
So if we add the transX of the lowerLeg and the ankle joints then we know how long the mime's leg naturally is.
We also need to know how far the ankle is from the top of the leg.
If the leg from upper to ankle is longer then the natural length, then we know the leg is hyperextended.
If we know this then we can figure out if the leg should be stretched.
We can find a ratio of how many times larger the current leg extention is from the default max extention.
ex. If the leg is naturally 6 + 4units long , and the leg is currently 15 from upper to ankle. Then the leg is 1.5 times longer.
We can use this ratio and multiply the current leg length.
Ex. 9 and 6 units long for the stretched leg.
Hopefully that made some sense.
STEP 2: Create the distant node
Create a distance measurement. create -> measurement tools -> distance tool. Click anywhere twice.
Rename locator1 "left_leg_stretch_dist_start", Rename locator 2 "left_leg_stretch_dist_end"
Rename the distance dimension node "left_leg_stretch_distance".
Vertex snap the start locator at the "left_upperLeg_ik_joint"
Vertex snap the end locator at the "left_ankle_ik_joint"
STEP 3: prep connections
Select the lowerleg joint and write down its translateX( #LL_dist# ).
Select the ankle joint and write down its translateX ( #AN_dist# ).
Add the two together and write it down as well ( #LL_dist# + #AN_dist# = #ALL_dist#)
Select the two locatos and the distance dimension.
Open the hypergraph. Window -> hypergraph connections.
For this connection we are going to do what is explained in step 1.
We need 3 muliply nodes and a condition node for this.
In the hypergraph menu -> render -> create render node... -> utility tab -> create 3 multiply nodes and 1 condition.
Rename one of the multiply nodes "left_leg_stretch_ratio".
Set the operation of the ratio to divide.
Rename one of the multiply nodes "left_lowerLeg_stretch_mult"
Rename one fo the multiply nodes "left_ankle_stretch_mult"
Rename the condition "left_leg_stretch_condition"
STEP 4: make connections
now make these connections
- Connect .distance from left_leg_stretch_distanceShape to the .input1X of left_leg_stretch_ratio.
- set the input2X on the ratio node to the natural distance, or #ALL_dist#
- Connect .outputX of ratio to .firstTerm of the condtion.
- Connect .outputX of ratio to .colorIfTrueR of the condition.
- Set secondTerm to 1 on the condition and the condtion to greater than.
- Connect the .outColorR of the condtion to the .input1X of both the stretch_mults.
- set the input2X on the lowerLeg mult to the natural distance of the lowerLeg, or #LL_dist#
- set the input2X on the ankle mult node to the natural distance of the ankle, or #AN_dist#
- Select both of the stetch mults and select the lowerLeg joint and the ankle joint from the hierarchy.
- Press the input/output connections button in the hypergraph.
- Connect the .outputX of the stretch_mults into the corresponding joint .translateX.
STEP 5: finish stretchy legs
Parent constrain the end locator to the leg_ik.
Group the distance dimension node and the locators together.
Rename the group, "left_leg_stretch_grp".
Place the group in the "do_not_touch_grp".
Hide both of the stretch locators.