UKismetMathLibrary::Conv_VectorToRotator
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the FRotator that represents the orientation in which the vector points. Roll is always zero — only Yaw and Pitch are computed.
Caveats & Gotchas
- • Roll is always 0. If you need to preserve roll, use a quaternion-based approach or compute roll separately.
- • Passing a near-zero vector (e.g. FVector::ZeroVector) produces an undefined/garbage rotation. Guard against zero-length vectors before calling.
- • This is a BlueprintAutocast node — Blueprint silently inserts it when a Vector pin is wired to a Rotator input, which can produce unexpected zero-roll rotators if roll was intended.
Signature
static UE_INL_API FRotator Conv_VectorToRotator(FVector InVec); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InVec | FVector | A direction vector to convert into a rotation. | — |
Return Type
FRotator Example
Make an actor face a target C++
FVector Direction = (TargetActor->GetActorLocation() - Actor->GetActorLocation()).GetSafeNormal();
FRotator LookAtRot = UKismetMathLibrary::Conv_VectorToRotator(Direction);
Actor->SetActorRotation(LookAtRot); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?