UKismetMathLibrary::Divide_VectorFloat
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Divides all components of a vector by a scalar float. Equivalent to multiplying by the reciprocal; commonly used to normalize speed or convert between unit scales.
Caveats & Gotchas
- • Passing B = 0.0 produces a vector of Inf values and triggers a logged error in development builds via ReportError_Divide_VectorFloat. There is no safe fallback — the caller must guard against zero.
- • Prefer Multiply_VectorFloat(A, 1.0/B) in hot-loop code if B is constant — the compiler may not auto-optimize the division to a multiply, whereas explicitly storing the reciprocal guarantees it.
Signature
static UE_INL_API FVector Divide_VectorFloat(FVector A, double B = 1.f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The vector to divide. | — |
| B | double | Scalar divisor. | 1.f |
Return Type
FVector Example
Convert centimeter vector to meter scale C++
FVector PositionCm = MyActor->GetActorLocation(); // UE default is cm
FVector PositionMeters = UKismetMathLibrary::Divide_VectorFloat(PositionCm, 100.0); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?