Quaternions to Rotator (FQuat and FRotator) How can I convert?

Hi,

I have data in the form of Quats streaming in w, x, y, z.

I’m a bit confused as to how I can apply this in Unreal to my Actor object. Do I need to convert this explicitly to a Rotator first?
Ideally I would like the result to be accessible in Blueprints with UPROPERTY

This is what I have currently that seems to do nothing:



FQuat myQuatToRot(IncomingStruct.wRot, IncomingStruct.xRot, IncomingStruct.yRot, IncomingStruct.zRot);
FRotator myRot(myQuatToRot);
IncomingStruct.calculatedRotator = myQuatToRot.Rotator();




Help !

Quaternion functions aren’t really exposed to Blueprint, since they aren’t very artist/content-creator friendly. Usually you just convert to/from FRotator if you need to pass rotation information in and out of Blueprint.

You say your code does ‘nothing’ – what is it supposed to do?

Perhaps I can give you a bit more of an outline of what I’m trying to achieve:

Data is streaming to the game in Quaternion format. When I convert this to Rotator(Euler), It seems to be working in only 1 axis. However the same data converted in other software is producing valid angles.

I suspect it might be a euler lock/flip issue so I was hoping to eliminate that by applying the quaternions to the object in Unreal to see if it solves it.

Exposing the UPROPERTY to Blueprint should be fine if you want it to return a Rotator. You can return a Quaternion but you can’t do much with them in Blueprint, if anything.

What’s the purpose of the second line in that code snippet you posted?