RealDocs

UKismetMathLibrary::Quat_FindBetweenNormals

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

Description

Generates the shortest quaternion rotation between two unit-length vectors. Faster than Quat_FindBetweenVectors because it skips internal normalization.

Caveats & Gotchas

  • Both input vectors must be unit-length; passing non-normalized vectors will produce incorrect rotations without any error or assert in shipping builds.
  • The antiparallel case (dot product == -1) still produces an arbitrary perpendicular rotation. If you need a deterministic fallback for opposite normals, pick a fallback axis explicitly.

Signature

static UE_INL_API FQuat Quat_FindBetweenNormals(FVector StartNormal, FVector EndNormal);

Parameters

Name Type Description Default
StartNormal FVector Unit-length vector the rotation starts from.
EndNormal FVector Unit-length vector the rotation ends at.

Return Type

FQuat

Example

Align a mesh normal to a surface hit normal C++
// MeshUp is already unit-length (e.g. actor Up vector)
FVector MeshUp = GetActorUpVector();
FVector SurfaceNormal = HitResult.Normal; // normals from line traces are already unit
FQuat AlignRot = UKismetMathLibrary::Quat_FindBetweenNormals(MeshUp, SurfaceNormal);
SetActorRotation((AlignRot * GetActorQuat()).Rotator());

Version History

Introduced in: 4.15

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.