{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Cross Product in Unreal Engine 5 C++UE Docs

The Cross Product Blueprint node maps to FVector::CrossProduct(A, B) in Unreal Engine 5 C++, with the shorthand operator A ^ B.

Blueprint node & C++ equivalent

C++
FVector Cross = FVector::CrossProduct(A, B);   // or A ^ B

What does the Cross Product node do?

The cross product of two vectors returns a third vector perpendicular to both, following the left-handed rule used by Unreal's coordinate system. Its length equals the area of the parallelogram formed by the inputs, so parallel vectors yield a zero vector.

It is the go-to operation for building surface normals, finding a right or up axis from two known directions, and computing rotation axes.

The C++ equivalent

Call FVector::CrossProduct(A, B), which returns an FVector. Unreal also overloads the caret operator on FVector, so A ^ B gives the exact same result and keeps geometry math terse.

Order matters: swapping the operands flips the sign of the result, so A ^ B and B ^ A point in opposite directions.

When to use it in C++

Use the cross product to derive a perpendicular axis when you only have two vectors, for example computing a right vector from forward and up. Normalize the result with GetSafeNormal() when you need a unit-length direction rather than a magnitude-weighted vector.

Frequently asked questions

How do you calculate a cross product in UE5 C++?+

Call FVector::CrossProduct(A, B), which returns a perpendicular FVector. The operator A ^ B is an equivalent shorthand.

Why is A ^ B different from B ^ A in Unreal?+

The cross product is anti-commutative. Swapping the operands negates the result, so the two vectors point in opposite directions.

Related Math nodes

View all Math nodes →