UKismetMathLibrary::Vector_Set
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Sets all three components of a vector individually, mutating it in place. Avoids allocating a new FVector when you only need to update components.
Caveats & Gotchas
- • In C++, this is never preferable over A = FVector(X, Y, Z) or A.Set(X, Y, Z). The function exists to expose individual component mutation through Blueprint's UPARAM(ref) pattern.
- • Component parameters are double in UE5. Passing float variables promotes correctly, but precision can degrade for large world coordinates if intermediate calculations used float arithmetic.
Signature
static UE_INL_API void Vector_Set(UPARAM(ref) FVector& A, double X, double Y, double Z); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector& | The vector to modify in place. | — |
| X | double | New X component. | — |
| Y | double | New Y component. | — |
| Z | double | New Z component. | — |
Return Type
void Example
Update components of a reused vector in a loop C++
FVector Pos;
for (int32 i = 0; i < Count; ++i)
{
UKismetMathLibrary::Vector_Set(Pos, i * 100.0, 0.0, 0.0);
SpawnActorAt(Pos);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?