UKismetMathLibrary::Cross_VectorVector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the cross product of two 3D vectors, producing a vector perpendicular to both A and B. Magnitude equals |A||B|sin(angle); direction follows the right-hand rule.
Caveats & Gotchas
- • Cross product is not commutative: Cross(A, B) = -Cross(B, A). Swapping inputs produces an opposite-facing normal, which is a common source of inverted surface normal bugs.
- • When A and B are parallel (or either is a zero vector) the result is FVector::ZeroVector — you cannot normalize it to get a perpendicular axis. Always check for near-zero magnitude before normalizing the result.
Signature
static UE_INL_API FVector Cross_VectorVector(FVector A, FVector B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | First vector. | — |
| B | FVector | Second vector. | — |
Return Type
FVector Example
Compute a surface normal from two edge vectors C++
FVector Edge1 = VertB - VertA;
FVector Edge2 = VertC - VertA;
FVector Normal = UKismetMathLibrary::Cross_VectorVector(Edge1, Edge2).GetSafeNormal(); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?