Unreal Engine 5 · Blueprint → C++
Dot Product in Unreal Engine 5 C++UE Docs
The Dot Product Blueprint node maps to FVector::DotProduct(A, B) in Unreal Engine 5 C++, which also has the shorthand operator A | B.
Blueprint node & C++ equivalent
float Dot = FVector::DotProduct(A, B); // or A | BWhat does the Dot Product node do?
The dot product multiplies two vectors component-wise and sums the results, returning a single scalar. It measures how aligned two vectors are: positive when they point the same way, zero when perpendicular, and negative when opposed.
For normalized vectors, the result equals the cosine of the angle between them, which is why it is the standard test for facing direction and field-of-view checks.
The C++ equivalent
Call FVector::DotProduct(A, B), which returns a float. Unreal also overloads the bitwise-or operator on FVector, so A | B produces the identical result and reads more compactly in math-heavy code.
Both forms expect two FVector operands and require no extra includes beyond the engine's core math headers, which are already available in most gameplay files.
When to use it in C++
Use the dot product to decide whether an enemy is in front of the player, to project one vector onto another, or to drive lighting and falloff. Normalize the inputs first when you need an angle, since the magnitude of unnormalized vectors scales the result.
Frequently asked questions
How do you calculate a dot product in UE5 C++?+
Call FVector::DotProduct(A, B), which returns a float. You can also write A | B, since FVector overloads the | operator to mean dot product.
What does the A | B operator do for FVector?+
It is shorthand for the dot product of A and B. It returns the same scalar as FVector::DotProduct(A, B).