RealDocs

UKismetAnimationLibrary::K2_TwoBoneIK

function AnimGraphRuntime Blueprint Since 4.0
#include "KismetAnimationLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Computes the joint and end positions for a two-bone IK chain (like an arm or leg) so it reaches toward an effector target, given an optional joint/pole target to control bend direction.

Caveats & Gotchas

  • This is the pure math version of the Animation Blueprint "Two Bone IK" node — it computes positions only and does not itself modify a skeleton; you still need to feed OutJointPos/OutEndPos into a Transform (Modify) Bone node or equivalent.
  • When bAllowStretching is false (the default), the chain simply clamps to its natural reach and will not extend to touch an effector that's further away than RootPos-to-EndPos length.
  • JointTarget only influences bend direction (which side the elbow points), not the final joint position when the chain is fully stretched or fully compressed.

Signature

static void K2_TwoBoneIK(const FVector& RootPos, const FVector& JointPos, const FVector& EndPos, const FVector& JointTarget, const FVector& Effector, FVector& OutJointPos, FVector& OutEndPos, bool bAllowStretching, float StartStretchRatio, float MaxStretchScale)

Parameters

Name Type Description Default
RootPos const FVector& Input root position of the two-bone chain.
JointPos const FVector& Input center (elbow) position of the two-bone chain.
EndPos const FVector& Input end (wrist) position of the two-bone chain.
JointTarget const FVector& The IK target the joint (elbow) should bend toward.
Effector const FVector& Position of the target effector for the end of the IK chain.
OutJointPos FVector& Outputs the resulting position for the center (elbow) joint.
OutEndPos FVector& Outputs the resulting position for the end (wrist) joint.
bAllowStretching bool If true, the bones are allowed to stretch beyond their rest length to reach the effector. false
StartStretchRatio float The ratio at which the chain starts to stretch; higher values delay the onset of stretching. 1.0
MaxStretchScale float The maximum multiplier the chain's stretch can reach. 1.2

Return Type

void

Example

Compute an arm IK solve C++
FVector OutJointPos, OutEndPos;
UKismetAnimationLibrary::K2_TwoBoneIK(
    ShoulderPos, ElbowPos, WristPos,
    ElbowPoleTarget, HandEffectorTarget,
    OutJointPos, OutEndPos,
    false, 1.0f, 1.2f);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.