RealDocs

UKismetMathLibrary::MakeRotFromY

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Builds a rotator whose right axis aligns with the given vector. X and Z axes are orthonormal but otherwise arbitrary. Rarely used — most UE conventions orient objects along X (forward).

Caveats & Gotchas

  • In UE's left-handed coordinate system the Y axis points right; using this to orient a mesh that was authored pointing along X will cause the mesh to appear sideways.
  • Passing a zero vector produces an undefined rotator without error.

Signature

static UE_INL_API FRotator MakeRotFromY(const FVector& Y);

Parameters

Name Type Description Default
Y const FVector& The desired right (Y) axis direction. Does not need to be normalized.

Return Type

FRotator

Example

Align a side-scrolling sprite's right axis C++
FVector RightDir = FVector(0.f, 1.f, 0.f);
FRotator Rot = UKismetMathLibrary::MakeRotFromY(RightDir);
Sprite->SetWorldRotation(Rot);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.