Difference between revisions of "$ikchain"

From Valve Developer Community
Jump to: navigation, search
m (Syntax)
Line 4: Line 4:
*'''ikchains''' are used only to apply '''ikrule''' and '''iklock''' options to an animation [[$sequence]].
*'''ikchains''' are used only to apply '''ikrule''' and '''iklock''' options to an animation [[$sequence]].
* See also [[$ikautoplaylock]].

Revision as of 16:19, 12 May 2008

The Inverse Kinematics (IK) system calculates the position of a middle_joint based on fixed distances from the positions of a top_joint and an end_joint. A good example is an ankle-knee-hip IK chain, where the ankle (end_joint) is positioned relative to the ground, the hip (top_joint) is locked in place, and the knee (middle_joint) is moved to a position such that the shin and thigh bones maintain their original length. Depending in the specific ikrule used, when the end_joint is moved into the needed position, the top_joint's position is assumed to be fixed, and the IK system positions the middle_joint so that the distances between the joints (ie the bone lengths) remain constant.

Tip:A joint is where a bone attaches to its parent bone. All bones (except the root bone) must have only one joint, so the "bonename" is also used to specify its joint.


$ikchain (name) (end_bone) [height (units)] [pad (units)] [floor (units)]
  • name : defines the "ikchainname" for this IK chain.
  • end_bone : The three bones affected by this IK chain are defined by specifying the bone farthest down in the chain. The next two bones are automatically found by climbing the Bone hierarchy. An IK chain may only have three bones.
  • height : To do: ?
  • pad : To do: ?
  • floor : To do: ?
  • QC example :
$ikchain rhand ValveBiped.Bip01_R_Hand knee  0.707 0.707 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee  0.707 0.707 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee  0.707 -0.707 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee  0.707 -0.707 0.000

To do: what is the "knee" parameter about?

$ikchain rules

iklock (ikchainname) (lock_position) (maintain local rotation)
  • iklock keeps track of the position/orientation of the specific chain before the sequence is applied, then after it’s applied, does a local IK rule to move it back into position/orientation. This is used to keep the specified IK chains from moving during this sequence, which can be useful when applying pelvis or body motion to a model but you want the hands or feet to remain in place.
  • ikchainname : The name of the $ikchain that the rule will apply to.
  • lock_position : To do: ? The weights are floating point values form 0.0 to 1.0.
  • maintain local rotation : To do: clarify : The value for the rotation lock is somewhat backwards from the position. To lock both of them, set it to "1 0", to let both of them freely move, set it to "0 1" (which is pointless, just don’t do the iklock in this case, but you get the idea).
ikrule (ikchainname) touch (bonename) [options...]
  • Adds an IK rule where a bone needs to be positioned relative to another part of the body. This is useful when the hand needs to touch some other part of the model, such as the face, hip, other hand, etc., and that other body part may be not in the original animated location due to additional animation layers, bone controllers, or other ikrules.
  • ikchainname : The name of the $ikchain that the rule will apply to.
  • bonename : Specify a bonename of "" to get the chain to move relative to the models origin instead of an animated bone.
  • options : See below.
ikrule (chainname) footstep (slot #) [options...]
  • Adds an IK rule where a subsequent body part – such as a foot – needs to be moved relative to the ground.
  • ikchainname : The name of the $ikchain that the rule will apply to.
  • slot # : To do: ?
  • options : See below.

ikrule options

range (start) (peak) (tail) (end)
  • Sets the fade-in, hold, and fade-out frame numbers for the ikrule.
height (units)
  • Used by footstep rules, specifies how high to start the search above the desired ground height.
floor (units)
  • Used by footstep rules, specifies where the actual ground is ground height.
pad (radius)
  • Used by footstep rules, specifies how big the ground contact check should be.
contact (frame)
  • Used by footstep rules, specifies what frame use use when checking for ground position.
radius (units)
  • Used by attachment rules, specifies how out to search.
  • Use the original animation source to determine the IK goals. This is use useful if the current sequence is a composite that is different from the source animation and you want to get the movement back to its original form.
  • Run all the sequence rules, including blendlayer and addlayer rules to determine the IK goals.