RealDocs

UKismetMathLibrary::Subtract_VectorFloat

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

Description

Subtracts a scalar float from every component of a vector, returning {A.X-B, A.Y-B, A.Z-B}. Useful for uniformly shrinking extents or applying a uniform negative bias.

Caveats & Gotchas

  • Subtracting a positive scalar decreases all three axes equally, which changes the vector's magnitude and direction unless A is along a single axis — verify this is the intended behavior before using it for direction calculations.
  • There is no divide-by-zero risk here, but the result may have negative components, which can silently invert behavior if the result is later used as an extent or scale.

Signature

static UE_INL_API FVector Subtract_VectorFloat(FVector A, double B);

Parameters

Name Type Description Default
A FVector The source vector.
B double Scalar to subtract from each component.

Return Type

FVector

Example

Shrink box extents uniformly C++
FVector Extents = MyBox.GetExtent();
FVector Shrunk = UKismetMathLibrary::Subtract_VectorFloat(Extents, 5.0);

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.