UKismetMathLibrary::GetRotated2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns a copy of the 2D vector rotated by the given angle in degrees around the Z axis (0,0,1). Positive angles rotate counter-clockwise when viewed from above.
Caveats & Gotchas
- • Rotation is always around the origin (0,0), not around an arbitrary pivot. Translate the vector relative to your pivot, rotate, then translate back if you need pivot-based rotation.
- • The angle is in degrees, not radians — a common source of bugs when porting math from other engines or papers.
Signature
static UE_INL_API FVector2D GetRotated2D(FVector2D A, float AngleDeg); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | The 2D vector to rotate. | — |
| AngleDeg | float | Angle in degrees to rotate counter-clockwise. | — |
Return Type
FVector2D Example
Rotate a 2D aim direction by 45 degrees C++
FVector2D AimDir = FVector2D(1.f, 0.f);
FVector2D Rotated = UKismetMathLibrary::GetRotated2D(AimDir, 45.f);
// Rotated ≈ (0.707, 0.707) Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?