RealDocs

UKismetMathLibrary::MakeRelativeTransform

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Computes the relative transform of A compared to RelativeTo — the offset transform that, applied on top of RelativeTo, reproduces A. Commonly used to compute a child's local offset from a parent when both are known in world space.

Caveats & Gotchas

  • Both A and RelativeTo must be expressed in the same space (typically world space); mixing spaces produces a meaningless result with no error or warning.
  • This is equivalent to A * RelativeTo.Inverse() — if RelativeTo has near-zero scale on any axis the inversion becomes numerically unstable.

Signature

static FTransform MakeRelativeTransform(const FTransform& A, const FTransform& RelativeTo)

Parameters

Name Type Description Default
A const FTransform& The object's transform.
RelativeTo const FTransform& The transform the result is relative to, expressed in the same space as A.

Return Type

FTransform

Example

Compute a child actor's offset from its parent C++
FTransform ChildOffset = UKismetMathLibrary::MakeRelativeTransform(Child->GetActorTransform(), Parent->GetActorTransform());
// ChildOffset can later be re-applied to a new parent transform to reposition the child

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.