RealDocs

UKismetMathLibrary::MakeRotFromYZ

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

Description

Builds a rotator with Y fixed as the right axis and Z adjusted for orthogonality. X (forward) is computed as the cross product. Useful for aligning objects to a slope while keeping a defined right direction.

Caveats & Gotchas

  • Y is the primary axis and is preserved; Z may be slightly rotated to achieve orthogonality. If you care about both axes equally, use MakeRotationFromAxes instead.
  • Zero or parallel inputs produce degenerate results without error.

Signature

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

Parameters

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

Return Type

FRotator

Example

Align foliage to a slope keeping a defined lateral axis C++
FVector SlopeNormal = HitResult.ImpactNormal;
FVector ConstantRight = FVector(1.f, 0.f, 0.f);
FRotator FoliageRot = UKismetMathLibrary::MakeRotFromYZ(ConstantRight, SlopeNormal);

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.