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 = CP * CY; M = CP * SY; M = SP; M = SR * SP * CY - CR * SY; M = SR * SP * SY + CR * CY; M = - SR * CP; M = -( CR * SP * CY + SR * SY ); M = CY * SR - CR * SP * SY; M = 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.