RealDocs

UKismetMathLibrary::Matrix_SetOrigin

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

Description

Sets the translation component of the matrix to the supplied vector, replacing any existing translation. Rotation and scale rows are not affected.

Caveats & Gotchas

  • Writes directly to the W column of the FMatrix — the change is immediate and in-place. If the matrix is shared (e.g., stored in a TArray and referenced by index), all users of that matrix will see the new origin.
  • The W component of the matrix's 4th row (M[3][3]) is not touched; it remains whatever value it had. For standard transform matrices this is 1.0f, but custom matrices may differ.

Signature

static UE_INL_API void Matrix_SetOrigin(UPARAM(Ref) FMatrix& M, FVector NewOrigin)

Parameters

Name Type Description Default
M UPARAM(Ref) FMatrix& The matrix to modify in-place.
NewOrigin FVector The new translation (position) to write into the matrix.

Return Type

void

Example

Teleport a matrix to a new position without changing orientation C++
FMatrix M = MyComponent->GetComponentTransform().ToMatrixWithScale();
UKismetMathLibrary::Matrix_SetOrigin(M, FVector(500.f, 0.f, 200.f));
// M now has the same rotation/scale but is located at (500, 0, 200)

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.