UKismetMathLibrary::Vector2D_Unit45Deg
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns the normalised 2D unit vector pointing along the 45-degree diagonal: (sqrt(0.5), sqrt(0.5)) ≈ (0.707, 0.707). Its magnitude is exactly 1.
Caveats & Gotchas
- • The returned value uses double-precision sqrt(0.5), so the magnitude is 1.0 to full floating-point precision. Do not re-normalise it — doing so may introduce a tiny rounding error.
- • Both components are positive, so this points toward the upper-right (or lower-right depending on your Y-axis convention). To get the other diagonal directions, negate components as needed.
Signature
static UE_INL_API FVector2D Vector2D_Unit45Deg(); Return Type
FVector2D Example
Project a velocity onto the 45-degree axis C++
FVector2D Velocity(3.0, 4.0);
FVector2D Axis = UKismetMathLibrary::Vector2D_Unit45Deg();
double Projection = FVector2D::DotProduct(Velocity, Axis);
// Projection == (3 + 4) * sqrt(0.5) ≈ 4.95 Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?