UKismetMathLibrary::Vector4_DotProduct
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the 4D dot product of two FVector4 values: A.X*B.X + A.Y*B.Y + A.Z*B.Z + A.W*B.W. All four components contribute to the result.
Caveats & Gotchas
- • This is a full 4-component dot product including W. If you are working with 3D direction vectors stored in a Vector4 (W=0), use Vector4_DotProduct3 instead to avoid the W component contaminating the result.
- • When used on unit quaternions (stored as Vector4), this gives the cosine of the half-angle between them — but FQuat has dedicated methods for quaternion operations that are safer to use.
Signature
static UE_INL_API double Vector4_DotProduct(const FVector4& A, const FVector4& B) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector4& | First vector. | — |
| B | const FVector4& | Second vector. | — |
Return Type
double Example
Compute alignment between two 4D vectors C++
FVector4 A(0.0, 1.0, 0.0, 0.0);
FVector4 B(0.0, 0.7071, 0.7071, 0.0);
double Dot = UKismetMathLibrary::Vector4_DotProduct(A, B);
// Dot ~= 0.7071 (45-degree angle between them) Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?