If we imagine a vector V in Unreal space V=(0,0,1) and then rotate that vector (around the coordinate origin) by some rotator R, in this example +90deg around the X axis R=(90,0,0) our vector should now be (0,1,0), we moved it from the Z to the Y axis.
If I’m correct this should be an example of rotating a vector by a rotator.
the problem is Unreals code does something different:
FVector v1 = h.ImpactNormal;
v1 = player->GetActorRotation().RotateVector(v1);
This piece of code produces completely unpredictable results, at least to my eyes.
But to add to my confusion, it works perfectly if I perform this rotation in stages, like so:
FVector v1 = h.ImpactNormal;
v1 = v1.RotateAngleAxis(player->GetActorRotation().Roll, FVector(1,0,0));
v1 = v1.RotateAngleAxis(player->GetActorRotation().Pitch, FVector(0,1,0));
v1 = v1.RotateAngleAxis(player->GetActorRotation().Yaw, FVector(0,0,1));
So my question is what is happening here, the second method works as described above, but why does it differ from the first, and what does the first method actually do?