When I use getWorldRotation for a static mesh actor (code or blueprint), I get a rotator back as output.
I wonder if the angles are Euler Angles (three independet angles)?
When I look at the FRotator, there is a function FRotator::Euler, which converts Rotators into Euler angles…
Then what are Rotators composed of? What are the Rotator angles if not Euler angles?
The question boils down to: are the rotator angles pitch, yaw, roll independent?
Unfortunately the documentation is pretty poor and more like’ if you want to know, then decipher the soure code!’
Yeah, FRotator uses angles in degrees, the FRotator documentation page even says so right on top. All FRotator::Euler does is return an FVector with the pitch, yaw, and roll values.
yes, I knew that they are stored in degrees, but was wondering if they are already Euler angles, or some other angles that are maybe interdependent. Degrees does not have to be Euler angles, but can be some other convention.
Suspicious is, that the FRotator::Euler documentation seems to say that whatever is stored as angles (in degrees) in a rotator gets converted to Euler angles (in degrees) with FRotator::Euler.
is there some documentation about angular conventions in UE4 or is it ‘feel free to look up the source code’?
FRotatator uses euler angles. FRotator::Euler just creates an FVector with the angles from the FRotator. Also you can use FRotator::Clamp to clamp each angle between 0 and 360 degrees.
It’s worth noting that you can use FRotators as FQuats (Quaternions JIC), you just have to convert them first. Unreal does the hard part for you I believe, just use MyRotator.Quaternion (might be just Quat, can’t remember) to get the Quaternion rotation.
That’s the only way you’ll get 100% independent axis rotation I believe. I use rotations around axes.
that’s a good idea.
I think euler angles are also independent, i.e. you change one, and the others stay constant, but with Euler angles there is the 1. gimbal lock problem and 2. the aliasing problem (multiple angle combinations are possible to reach the same target)
I think UE4 might have that aliasing problem when e.g. getWorldRotation for a static mesh is used.
Quarterions are like a vector with a rotation attached to it. So every quarterion has 4 values: (angle, x,y,z).
Like a 3D model of a screw aligned to the x-axis, pointing to the coordinate system center: the quarterion for it would be x=1 and y,z=0; and the angle would be by how much you turn the screw with a screwdriver. This way you can fully describe the rotation of the screw. If it was aligned 45° in the x,y plane, the quarterion would be x=0.707, y=0.707, z=0. And then the angle again.
I am just thinking loud here. I have never used quarterions, but this would make sense and would resolve the Euler angle issues.
Does someone have experience with quarterions? Am I on the right track?
I WISH I had experience with Quats but I still don’t fully understand them I think they’re an art unto themselves…
What I’ve been doing so far is rotation around an axis, so just multiply the Forward axis by a certain value to add Roll rotation for example. This works pretty much all the time.