UKismetMathLibrary::Divide_VectorInt
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Divides all components of a vector by an integer. Primarily exists for Blueprint integer pin compatibility.
Caveats & Gotchas
- • Passing B = 0 (integer zero) will produce Inf components and trigger a logged error via ReportError_Divide_VectorInt in development builds; unlike float division, there is no gradual underflow — the result jumps directly to infinity.
- • Integer division here does NOT truncate — B is widened to double before the division, so the result preserves fractional parts (e.g. dividing FVector(5,5,5) by 2 gives (2.5, 2.5, 2.5), not (2, 2, 2)).
Signature
static UE_INL_API FVector Divide_VectorInt(FVector A, int32 B = 1); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The vector to divide. | — |
| B | int32 | Integer divisor. | 1 |
Return Type
FVector Example
Average two vectors by summing and dividing C++
FVector Sum = UKismetMathLibrary::Add_VectorVector(VecA, VecB);
FVector Average = UKismetMathLibrary::Divide_VectorInt(Sum, 2); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?