RealDocs

UKismetAnimationLibrary::K2_DirectionBetweenSockets

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

Description

Returns the normalized world-space direction vector from one named socket/bone to another on a skeletal mesh.

Caveats & Gotchas

  • Marked NotBlueprintThreadSafe — cannot run inside multithreaded Anim Graph evaluation like most of this library.
  • Always evaluates in world space; there is no space parameter, unlike K2_DistanceBetweenTwoSocketsAndMapRange.
  • Returns a zero vector if the two sockets/bones resolve to the same position, which can produce NaN downstream if that result is used to build a rotation without a zero-length check.

Signature

static FVector K2_DirectionBetweenSockets(const USkeletalMeshComponent* Component, const FName SocketOrBoneNameFrom, const FName SocketOrBoneNameTo)

Parameters

Name Type Description Default
Component const USkeletalMeshComponent* The skeletal component to look up the sockets/bones within.
SocketOrBoneNameFrom const FName Name of the source socket or bone.
SocketOrBoneNameTo const FName Name of the destination socket or bone.

Return Type

FVector

Example

Get aim direction from hips to head C++
const FVector AimDir = UKismetAnimationLibrary::K2_DirectionBetweenSockets(
    SkeletalMeshComp, TEXT("pelvis"), TEXT("head"));

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.