RealDocs

UKismetMathLibrary::TransformVector4

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

Description

Multiplies a FVector4 by an FMatrix (Matrix * Vec4) and returns the resulting FVector4. Performs a full 4x4 homogeneous transform including the W component, making it suitable for projective transformations.

Caveats & Gotchas

  • Unlike FTransform-based helpers, this operates on raw FMatrix and includes the W row/column — perspective divide is NOT done automatically, so if you need NDC coordinates from a projection matrix, you must divide XYZ by W yourself.
  • Argument order is Matrix then Vec4 (column-vector convention); reversing them will give a transposed transform. Note that FMatrix::TransformFVector4 and this function are equivalent but with argument order swapped.

Signature

static UE_INL_API FVector4 TransformVector4(const FMatrix& Matrix, const FVector4& Vec4);

Parameters

Name Type Description Default
Matrix const FMatrix& The 4x4 matrix to transform by.
Vec4 const FVector4& The four-component vector to transform.

Return Type

FVector4

Example

Project a world-space point to clip space C++
FMatrix VP = ViewMatrix * ProjectionMatrix;
FVector4 ClipPos = UKismetMathLibrary::TransformVector4(VP, FVector4(WorldPos, 1.0f));
// Perspective divide for NDC:
FVector NDC = FVector(ClipPos) / ClipPos.W;

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.