RealDocs

UKismetMathLibrary::Conv_Vector4ToRotator

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

Description

Converts a Vector4 to an FRotator representing the direction the XYZ components point. Sets Yaw and Pitch from the direction; Roll is always zero because a direction vector cannot encode roll.

Caveats & Gotchas

  • Roll is always 0 in the output. If you need a full rotation including roll, store roll separately and compose it after this call using FRotator arithmetic.
  • The W component is completely ignored. If InVec has a zero XYZ part (e.g. (0,0,0,1)), you get a zero rotator with no warning.

Signature

static UE_INL_API FRotator Conv_Vector4ToRotator(const FVector4& InVec);

Parameters

Name Type Description Default
InVec FVector4 The source Vector4 whose XYZ direction is used.

Return Type

FRotator

Example

Orient an actor to face along a Vector4 direction C++
FVector4 FacingDir(1.0, 1.0, 0.0, 0.0);
FRotator FacingRot = UKismetMathLibrary::Conv_Vector4ToRotator(FacingDir);
SetActorRotation(FacingRot);

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.