RealDocs

UKismetMathLibrary::Quat_FindBetweenVectors

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

Description

Generates the shortest quaternion rotation that takes the Start vector to the End vector. Vectors can be any length — they are normalized internally.

Caveats & Gotchas

  • If Start and End are exactly opposite (antiparallel), the function returns an arbitrary perpendicular rotation; the result is valid but not deterministic. Use Quat_FindBetweenNormals with pre-normalized inputs if this edge case matters.
  • Unlike Quat_FindBetweenNormals, this variant normalizes both inputs internally, adding two sqrt operations. Prefer Quat_FindBetweenNormals when the inputs are already unit vectors.

Signature

static UE_INL_API FQuat Quat_FindBetweenVectors(FVector Start, FVector End);

Parameters

Name Type Description Default
Start FVector The vector the rotation starts from (any length).
End FVector The vector the rotation ends at (any length).

Return Type

FQuat

Example

Orient a projectile toward a target point C++
FVector ToTarget = (TargetLocation - GetActorLocation());
FVector Forward = GetActorForwardVector();
FQuat NeededRot = UKismetMathLibrary::Quat_FindBetweenVectors(Forward, ToTarget);
FQuat NewQuat = NeededRot * GetActorQuat();
SetActorRotation(NewQuat.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.