Hello,
I would love to clarify some things in Unreal. I am no expert on rotation matrices but I foresee the cacophony of quaternion mentions, I know they are better/easier for representing rotations. Those things aside, I want to understand what is going on here.
I was looking at the code in FRotationTranslationMatrix::FRotationTranslationMatrix and can’t identify which order of rotational operations this matrix is supposed to represent"
{
const float SR = FMath::Sin(Rot.Roll * PI / 180.f);
const float SP = FMath::Sin(Rot.Pitch * PI / 180.f);
const float SY = FMath::Sin(Rot.Yaw * PI / 180.f);
const float CR = FMath::Cos(Rot.Roll * PI / 180.f);
const float CP = FMath::Cos(Rot.Pitch * PI / 180.f);
const float CY = FMath::Cos(Rot.Yaw * PI / 180.f);
M[0][0] = CP * CY;
M[0][1] = CP * SY;
M[0][2] = SP;
M[1][0] = SR * SP * CY - CR * SY;
M[1][1] = SR * SP * SY + CR * CY;
M[1][2] = - SR * CP;
M[2][0] = -( CR * SP * CY + SR * SY );
M[2][1] = CY * SR - CR * SP * SY;
M[2][2] = CR * CP;
}
I removed the translation and am just focusing on the rotational 3x3 portion of the matrix. The pattern of signs doesn’t match any of the typical ones I’ve seen. I’d like to know the order of operations here (pitch then roll then yaw? or something else). I’d also like to make sure I understand what those mean in Unreal space:
Yaw is rotation about Z-Axis (Up)?
Pitch is rotation about Y-Axis (Right)?
Roll is rotation about X-Axis (Forward)?
Left-handed coordinate system?
Thanks in advance!
PS: I hope there is no issue posting code, I figured this was generic enough and anyone who’s done graphic programming has seen at least one form of this.