UKismetMathLibrary::MakeRotFromXZ
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Builds a rotator from a primary X (forward) and secondary Z (up) axis, computing Y (right) as the cross product. X is fixed; Z may shift slightly to ensure orthogonality.
Caveats & Gotchas
- • Z is the secondary axis and may be rotated in the XZ plane to enforce orthogonality with X; use this when you care about forward direction and up hint but not exact right direction.
- • Parallel X and Z inputs produce an undefined result without a runtime error.
Signature
static UE_INL_API FRotator MakeRotFromXZ(const FVector& X, const FVector& Z); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | const FVector& | Primary (fixed) forward axis. | — |
| Z | const FVector& | Secondary up axis, adjusted minimally for orthogonality. | — |
Return Type
FRotator Example
Build an orientation from camera forward and world up C++
FVector CamForward = CameraComponent->GetForwardVector();
FVector WorldUp = FVector::UpVector;
FRotator Rot = UKismetMathLibrary::MakeRotFromXZ(CamForward, WorldUp); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?