convert Rotation Matrix to Unreal Quaternion

Hello.

I am trying to receive orientation and apply it to scene component from my Pawn.
I was trying to send Euler Angles directly, but they are applying incorrect in Unreal Engine (due to the incorrect order I suppose). So I decided to switch to Quaternions.

I discovered that Unreal uses Left-Handed coordinate system, z-up. So, according to this I am trying to apply rotation Matrix in Left-Handed Z-up to a scene component.

How can I create a suitable for Unreal quaternion out of rotation matrix?

And another question.
I noticed one thing: when you rotate with positive delta around X and Y axises in Unreal coordinates, the rotation appears to be clockwise (if you are looking towards the axis of rotation), while applying a rotation with positive delta around Z-axis leads to counter-clockwise rotation.
So, should I also take this into consideration, when applying rotation matrix to a scene component using quaternion?

Not sure if this is for blueprints or C++.

But you can break rotator struct and switch angles around if they are in wrong order. And multiple by -1 if they are in wrong direction.

Even for quaternations, if you have euler angles in wrong order, you need to fix it before feeding to quat function.

I think you asking for C++ :

FRotator MyRotator = YourRotationMatrix.Rotator();

then swap and possibly multiply them by -1
And use new angles directly or with new quaternation:

FQuat MyQuaternion = FQuat::MakeFromEuler(MyRotator);