UKismetMathLibrary::Subtract_Vector4Vector4
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the component-wise difference of two FVector4 values (A - B). All four components are subtracted independently.
Caveats & Gotchas
- • The W component is subtracted as well. When working with homogeneous coordinates, subtracting two points (W=1 each) gives a direction vector with W=0, which is mathematically correct — but you must track this invariant yourself; UE does not enforce it.
- • Operation is not commutative: Add_Vector4Vector4(A, Vector4_Negated(B)) gives the same result but is slower; prefer this function directly.
Signature
static UE_INL_API FVector4 Subtract_Vector4Vector4(const FVector4& A, const FVector4& B) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector4& | Vector to subtract from. | — |
| B | const FVector4& | Vector to subtract. | — |
Return Type
FVector4 Example
Compute a displacement vector between two 4D points C++
FVector4 Start(0.0, 0.0, 0.0, 1.0);
FVector4 End(10.0, 5.0, 0.0, 1.0);
FVector4 Delta = UKismetMathLibrary::Subtract_Vector4Vector4(End, Start);
// Delta == (10, 5, 0, 0) Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?