FRotator.Vector(); || Does Pitch, Yaw, and Roll gets converted to X, Y, and Z?

I’m learning C++ with Unreal Engine 4 here’s the code I would like a translation from:


    
FVector PlayerViewPointLocation
    (
        reach, // X-Axis
        0.0f, // Y-Axix
        0.0f // Z-Axis
    );

    FRotator PlayerViewPointRotator
    (
        0.0f, // Pitch
        0.0f, // Yaw
        0.0f // Roll
    ).Vector();


Does the FRotator gets converted into X,Y, and Z? Because from this guide it says to draw a debug line from beginning to the end. My real question is this, when I add .Vector() from a FRotator does it convert Pitch to an X-axis then multiply it by hundred?

Reach is a private variable from a .h file:



Private:

Float reach = 100.0f;


and here’s the code for the debug line:



    DrawDebugLine
    (
        GetWorld(),
        PlayerViewPointLocation,
        lineTraceEnd,
        FColor(255, 0, 0),
        false,
        0.0f,
        0.0f,
        10.0f
    );


Declare



    FVector lineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotator.Vector() * reach;


You could just read the source of that method and see what it does:

It’s basically a more efficient version of .RotateVector(FVector::ForwardVector).
Looks like your code at the end is correct.

1 Like