# What is FRotationMatrix in Unreal engine 4?

I am working on FPS shooter example in Unreal engine 4 documentation.

One of the lines for forward movement of pawn is

FVector Direction = FRotationMatrix(Controller->GetControlRotation()).GetScaledAxis(EAxis::X);


This line gets the forward facing direction of the pawn in world coordinates. I understand that part.

I would like to know what is it mathematically and how does FRotationMatrix get values it gets? How does simple 3 valued vector like rotation get converted to a 4x4 matrix?

To that end, FRotationMatrix is a FMatrix subclass that exists to facilitate constructing a matrix that represents a pure rotation with no translation or scale (which are also operations that can be encoded into a matrix).
It is constructed using an FRotator (in this case, the one from the player controller actor, Controller), which stores pitch, roll and yaw values. It uses those, ultimately, to construct a rotation matrix.
You could do the same thing yourself; pitch, roll and yaw just represent rotations around the Y, X and Z axes (in Unreal's coordinate system). You can build the three equivalent basic rotation matrices and then concatenate them to arrive at a result equivalent to what FRotationMatrix is computing.