RealDocs

UKismetMathLibrary::Quat_MakeFromRotationVector

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

Description

Constructs a quaternion from a rotation vector, where the vector's direction is the rotation axis and its magnitude is the rotation angle in degrees. The inverse of Quat_ToRotationVector.

Caveats & Gotchas

  • The magnitude is interpreted as degrees, not radians. Passing a radians-based vector will produce incorrect rotations.
  • Passing a zero vector produces the identity quaternion, so there is no divide-by-zero risk, but intent may be lost if the caller expected an error.

Signature

static UE_INL_API FQuat Quat_MakeFromRotationVector(const FVector& V);

Parameters

Name Type Description Default
V const FVector& Rotation vector where direction is the axis and magnitude is the angle in degrees.

Return Type

FQuat

Example

Construct a quaternion from axis and angle C++
// Rotate 45 degrees around World Z
FVector RotVec = FVector(0.f, 0.f, 1.f) * 45.f;
FQuat Q = UKismetMathLibrary::Quat_MakeFromRotationVector(RotVec);
SetActorRotation(Q.Rotator());

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.