Problem when converting a rotation to vector C++

Hello!

Inside: Tick (float DeltaTime)

to get the rotation of my character I just use:

FRotator MyCharacteRotator = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorRotation();

to prove that all this well I use a log on screen:

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT(“Player Rotator: %s”), *MyCharacteRotator.ToString()));

when I move my character correctly my vector is updated

274615-captura.png

I want to turn the rotation into a vector to get the coordinates x, y and z. but I can not find the correct way. since I use:

FVector NewRotationVector = MyCharacteRotator.Vector();

I do not know if it is the correct form or if I am doing something wrong because it only returns the value of 1 when the rotation is made. and should return values ​​like 0, 90, -90, -180

I’m waiting for an answer, thanks.

The vector and rotation are 2 separate things. Vectors are 3D coordinates like you said (X,Y,Z). Rotations are in degrees 0-90 for pitch, 0-180 for roll and yaw. You are asking to take a rotation and make a vector using the FRotator::Vector() function seen here:

http://api.unrealengine.com/INT/API/Runtime/Core/Math/FRotator/Vector/index.html.

This returns a unit vector pointing in the direction of rotation. That is why it is always 1. I think maybe you want FRotator::Euler() which you can see here:

if you just want to get the forward direction of your character, then there is no need to go over the rotation just use

GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorForwardVector()

thank you

Thanks for the information