RealDocs

UKismetMathLibrary::Subtract_Vector2DFloat

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

Description

Subtracts a scalar float from both components of a 2D vector, returning (A.X - B, A.Y - B). Useful for shrinking or offsetting a uniform 2D region.

Caveats & Gotchas

  • The scalar B is subtracted from both X and Y equally. To subtract different amounts per axis, use Subtract_Vector2DVector2D instead.
  • The parameter is declared as double in the header (UE5 double precision), but Blueprint treats it as a float pin.

Signature

static UE_INL_API FVector2D Subtract_Vector2DFloat(FVector2D A, double B);

Parameters

Name Type Description Default
A FVector2D The vector to subtract from.
B double The scalar value subtracted from both X and Y components.

Return Type

FVector2D

Example

Remove uniform border from a rect extent C++
FVector2D Extent(512.f, 256.f);
FVector2D Inner = UKismetMathLibrary::Subtract_Vector2DFloat(Extent, 8.0);
// Inner = (504, 248)

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.