RealDocs

UKismetMathLibrary::Vector_Reciprocal

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns a vector where each component is the reciprocal (1/x) of the corresponding input component. Zero components are replaced with a very large number (BIG_NUMBER) to avoid division by zero.

Caveats & Gotchas

  • Zero components are silently replaced with BIG_NUMBER (~3.4e38), not with infinity or NaN. Code that expects IEEE infinity or zero-check semantics will behave unexpectedly — inspect the result before using it in further math.
  • This is primarily a utility for per-component scaling inversion (e.g. undoing a scale vector). Using it to invert a direction vector for division produces numerically large values near zero axes that can overflow downstream calculations.

Signature

static UE_INL_API FVector Vector_Reciprocal(const FVector& A);

Parameters

Name Type Description Default
A const FVector& The vector whose components to invert.

Return Type

FVector

Example

Invert a scale vector for un-scaling C++
FVector ActorScale = GetActorScale3D();
FVector InvScale = UKismetMathLibrary::Vector_Reciprocal(ActorScale);
// Apply to a child transform that needs to cancel the parent scale
ChildTransform.SetScale3D(InvScale);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.