UKismetMathLibrary::Subtract_Vector2DVector2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the component-wise difference of two 2D vectors (A - B). Commonly used to compute directional offsets or deltas between screen positions.
Caveats & Gotchas
- • Order matters — unlike addition, subtraction is not commutative. A - B and B - A produce opposite results.
- • In Blueprint, the node is labeled 'vector2d - vector2d' with a compact '-' title. Ensure both input pins are connected to Vector2D sources, not Vector3D.
Signature
static UE_INL_API FVector2D Subtract_Vector2DVector2D(FVector2D A, FVector2D B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | The vector to subtract from. | — |
| B | FVector2D | The vector to subtract. | — |
Return Type
FVector2D Example
Compute delta between two widget positions C++
FVector2D Current(300.f, 150.f);
FVector2D Previous(250.f, 120.f);
FVector2D Delta = UKismetMathLibrary::Subtract_Vector2DVector2D(Current, Previous);
// Delta = (50, 30) Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?