UKismetMathLibrary::Matrix_SetColumn
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Writes an FVector into the specified column of the matrix in-place. Useful for directly manipulating the projection or translation columns without rebuilding the matrix.
Caveats & Gotchas
- • Only the first three rows (XYZ) of the column are written — row 3 of the chosen column (e.g., M[3][0]) is left unchanged. For standard TRS matrices this is 0 for X/Y/Z and 1 for W, which is the expected state.
- • Writing to column W replaces the translation, equivalent to calling Matrix_SetOrigin. Writing to columns X, Y, or Z changes the basis vectors and can break orthogonality if the new vector is not perpendicular to the remaining columns.
Signature
static UE_INL_API void Matrix_SetColumn(UPARAM(Ref) FMatrix& M, TEnumAsByte<EMatrixColumns::Type> Column, FVector Value) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | UPARAM(Ref) FMatrix& | The matrix to modify in-place. | — |
| Column | TEnumAsByte<EMatrixColumns::Type> | Which column to write: EMatrixColumns::X (0), Y (1), Z (2), or W (3). | — |
| Value | FVector | The XYZ values to write into the column. The 4th row element of the column is not touched. | — |
Return Type
void Example
Replace the translation column of a matrix C++
FMatrix M = SomeTransform.ToMatrixWithScale();
UKismetMathLibrary::Matrix_SetColumn(M, EMatrixColumns::W, FVector(100.f, 200.f, 0.f));
// M's translation is now (100, 200, 0) Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?