RealDocs

UKismetMathLibrary::Conv_Vector4ToQuaternion

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

Description

Converts a FVector4 direction into a FQuat orientation that points in that direction with no roll. Preserves the world up vector, similar to Conv_VectorToQuaternion.

Caveats & Gotchas

  • The W component of InVec is ignored — only XYZ direction is used. Passing a point (W=1) instead of a direction will still be treated as a direction.
  • If you don't need to preserve the up vector, FindBetweenVectors(ForwardVector, InVec) is faster because it avoids the internal FRotator construction step.
  • The input vector does not need to be normalized, but passing a zero-length vector produces an undefined result (quaternion identity in practice, but this is not guaranteed).

Signature

static UE_INL_API FQuat Conv_Vector4ToQuaternion(const FVector4& InVec)

Parameters

Name Type Description Default
InVec const FVector4& The direction vector to convert. Treated as a directional vector; W component is ignored.

Return Type

FQuat

Example

Orient an actor toward a world-space direction stored in a Vector4 C++
FVector4 FacingDir(1.0, 0.5, 0.0, 0.0);
FQuat Orientation = UKismetMathLibrary::Conv_Vector4ToQuaternion(FacingDir);
MyActor->SetActorRotation(Orientation);

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.