Get Rotation from XVector C++

Im trying to translate my blueprint into c++ and I’m having trouble converting the “Rotator from XVector” into code. Is there a simple way to do this is C++? any help would be fantastic, thank you


1 Like

FRotator FVector::Rotation() const

Should be what you’re looking for, it makes a FRotator that point toward this direction.

Im getting an error when trying to implement this. this is what I have got:

FRotator MovementRotation = FRotator FVector::Rotation(MovementVector) const;

The code i linked was the Fonction declaration, you can’t use it as it.

I don’t know the context of your implementation , according to your code you need to do something like this

FRotator MovementRotation = MovementVector.Rotation();

This is ancient but incase anyone else comes across this you can access all of those make rot from nodes from UKismetMathLibrary


This one worked for me. Thank you.

That’s what I was looking for. Since the Kismet library wraps the functions if you look at the actual definition it translates to:

FRotationMatrix::MakeFromX( ).Rotator();