UKismetMathLibrary::Divide_VectorVector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Divides two vectors component-wise, returning {A.X/B.X, A.Y/B.Y, A.Z/B.Z}. Useful for inverting a scale vector or converting from one coordinate space to another with per-axis scale.
Caveats & Gotchas
- • Division by zero on any component produces Inf or NaN, which will silently corrupt downstream calculations. Always ensure B has no zero components, or use a safe-divide helper. The engine logs an error via ReportError_Divide_VectorVector when this occurs in development builds.
- • The default value of B is (1,1,1), so calling with a single argument is safe, but connecting a variable that might contain a zero-component vector is a common Blueprint bug.
Signature
static UE_INL_API FVector Divide_VectorVector(FVector A, FVector B = FVector(1.f,1.f,1.f)); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The dividend vector. | — |
| B | FVector | The divisor vector. | FVector(1.f,1.f,1.f) |
Return Type
FVector Example
Invert a non-uniform scale to convert back to unit space C++
FVector WorldScale = MyComponent->GetComponentScale();
FVector LocalExtent = FVector(50.f, 50.f, 50.f);
// Convert extent from world scale back to local space
FVector LocalSpace = UKismetMathLibrary::Divide_VectorVector(LocalExtent, WorldScale); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?