Get Actor x, y, z rotation angle in shader

mpxc this piece of code helped me a lot, thanks!
However, the Y value was wrong so I modified code to work properly (UE5.1.1)

float3x3 WtoL = LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal);
float3 R = float3(
atan2(WtoL[2].y,WtoL[2].z) * -1.0,
atan2(WtoL[2].x,WtoL[2].z),
atan2(WtoL[1].x,WtoL[0].x)
);
return R < 0 ? 2 * pi - abs(R) : R;
1 Like