FVector::CrossProduct
#include "Math/Vector.h"
Access: public
Specifiers: static
Description
Returns the cross product of two vectors. The result is a vector perpendicular to both A and B, with magnitude equal to |A||B|sin(θ). Useful for computing normals, determining handedness, and generating perpendicular axes.
Signature
static FVector CrossProduct(const FVector& A, const FVector& B) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector& | First vector. | — |
| B | const FVector& | Second vector. | — |
Return Type
FVector Caveats & Gotchas
- • The order of A and B matters — `CrossProduct(A, B)` is the negation of `CrossProduct(B, A)`.
- • Can also be written as `A ^ B` using the operator overload.
Example
Computing a surface normal C++
FVector Edge1 = B - A;
FVector Edge2 = C - A;
FVector Normal = FVector::CrossProduct(Edge1, Edge2).GetSafeNormal(); See Also
Version History
Introduced in: 1.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?