Rotations, rotations...

Hello folks! I’m having a lot of headache over a simple thing.

I need the roll axis value of my motion controller for my IK bone transform. However, when I separate roll from pitch and yaw, it flips randomly 180 degrees for example when pitch axis approaches a certain magnitude. Also it’s not an instant flip but some kind of interpolated one, something like a gimbal lock? I don’t know. The result being my roll jumps all over the place, as long as it’s between -180 and 180. I need the roll only.

Is there a way to get around this?

I tried one cunning method → make a dummy which copies the motion controller rotation, attached a sphere to the end of it with an offset. Then when I rotate around roll axis the X position changes accordingly. However when the player turns 90 degrees, it’s no longer the X offset I should read for roll, but Y offset, and if player turns 180 degrees every axis flips again and… Well, let’s just say I can’t get it to work.

I also read some stuff about using quaternions, but giving the lack of quaternion functions in UE blueprint I suppose you can’t easily read a quat rotation of a component.

Perhaps there’s a more humane solution.

You are wrong, rotations in 3d are not a simple thing Yes you know dreaded word “quaternation”
Sorry I cannot help you, write what is exactly your problem (as simple as possible), there may be hax around it without quaternations.
Also short “story” about what you need it for may also help.

Thank you for replying. I have a IK hand rig and I want to do a forearm twist. I made 3 extra forearm bones and every one of them needs to rotate 1/3 times hand bone rotation in roll axis only. I tried bone driven rotation and transform bone in animation blueprint. They both work well. However, when I simply get rotation of the hand bone (or motion controller it’s attached to), I get inconsistent results, 180 degrees flips etc.

In pseudo code it’d be something like this:
Forearmbone.roll = Hand.roll * 0.3

Scale rotator also causes the flips to happen.

Please let me know if I explained it clearly, or would a video help?

Are you just looking for a single float value between 0 and 360 that represents the amount of “twist” your motion controller has? Are you able to get the Up and Right vectors of your motion controller?

Yes exactly. I do have the up and right vectors.

Edit: I was surprised ‘apply percentage of rotation’ flipped when pitch approached 180 when multiply factor was set to anything below 1.0, it seemed to be designed exactly for that purpose.