RealDocs

UKismetMathLibrary::MakeRotFromZY

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

Description

Builds a rotator with Z fixed as the up axis and Y adjusted for orthogonality, computing X as the cross product. Use when the surface normal and a lateral direction are both meaningful.

Caveats & Gotchas

  • Z is preserved; Y may shift to enforce orthogonality. If the lateral direction matters more, swap to MakeRotFromYZ.
  • Parallel Z and Y inputs silently produce a degenerate rotator.

Signature

static UE_INL_API FRotator MakeRotFromZY(const FVector& Z, const FVector& Y);

Parameters

Name Type Description Default
Z const FVector& Primary (fixed) up axis.
Y const FVector& Secondary right axis, adjusted for orthogonality.

Return Type

FRotator

Example

Align an object to a slope with a lateral axis hint C++
FVector GroundNormal = FloorHit.ImpactNormal;
FVector LateralHint = FVector(0.f, 1.f, 0.f);
FRotator Rot = UKismetMathLibrary::MakeRotFromZY(GroundNormal, LateralHint);
MeshComp->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.