How to use bone driven controller with pitch > 90°? (+ control rig question)

I need to drive a morph with bone rotation, it should be 0 below 70°, rise from 0 to 1 from 70 to 110° and stay at 1 after 110. “Bone driven controller” node is perfect but the problem is that my rotation is around Y axis. It will never go above 90° because of gimbal lock or whatever it’s called.

I cannot change the skeleton and I prefer not to use c++.

Pose driver node works, but it will not stay at 1 after the max angle, it will go back down. Twist corrective node seems to have similar issue.

I found a simple solution using the new control rig plugin, see picture below. But I don’t know if it’s okay to use it like that or it’s just for animating in sequencer? Also, it seems there is no way to just set a variable, so I had to use a dummy debug node instead. Also, my project is still 4.22.

Any ideas?

A workaround that might work would be to use a proxy bone attached to the upperarm, but rotate by 40-50°, so that your Y values won’t go over 90°, but it will stay in the range of 20-60°.
By doing this the gimbal lock won’t be an issue anymore, but its a trick, and since the control rig is brand new, you might want to do this within the AnimBP, since there you can do pretty much whatever you want :wink:

Thank you, but would that work? I mean, how I understand it, bone driven controller uses delta rotation relative to the parent. A proxy bone will have delta rotation of 0°.

I found a simple solution using c++. I took the EulerFromQuat method from ControlRigMathLibrary.h and put that in AnimNode_BoneDrivenController.cpp instead of the FQuat::ToEuler method. Seems to work.


    else if (SourceComponent < EComponentType::Scale)

        const FVector RotationDiff = EulerFromQuat(InCurrentBoneTransform.GetRotation() * InRefPoseBoneTransform.GetRotation().Inverse(), RotationOrder);
        SourceValue = - RotationDiff(int32)(SourceComponent - EComponentType::RotationX)];


You can also choose the rotation order that match better, like XYZ if you mostly rotate around X and Z, or ZXY if you rotate around Z and Y

But I’m still curious if same thing can be done in AnimBP without c++

I’ve put that on github, in case somebody need it

Nice, thanks for sharing!

I’m about to do some testing with characters corrective shapes transfering, so if I come up with something done in BP I’ll share it :wink:

We’re doing the same thing, lol
Btw, I found this modified node useful even when there is no 90° problem, For example, I have shoulder rotating around Z and Y, so with the default UE XYZ order rotating around Z will still result in some numbers showing in Y. With this node I can use YXZ or ZXY order so the Y and Z are not influencing each other anymore.
I don’t think there is something like that in BPs anyway. People who made Rig Plugin had to create their own math library for quaternions, there is no rotation order related stuff anywhere in FQuat as far as I understand.

Sorry for reviving this post,
but I found myself with this problem now, and I saw the code you provided @scha
Thank you for that, but… I don’t know what to do with that lol. I think I blueprinted my brain too much xD
I mean, what to do with that code? you have to modify source code adding that new code to the original .h and .cpp files and then build a custom version of the engine?
That’s out of my scope if that’s the only way :frowning:
I’ve tried creating a custom C++ class deriving from AnimNode_BoneDrivenController (and also tried with its parent) with no good results. I mean, as soon as I create the class, UE4 throws the error that needs the module to be manually compiled. But when trying to compile from visual studio, even without adding anything to the newly created class, there’s a bunch of errors thrown…
So, I was wondering, any step by step on how to do it is possible? or would be possible to create a new node in form of a plugin with that code you provided?
The later would be the ideal one. And sounds like a good plugin for the marketplace I would be happy to purchase :3

-btw all I tried is on 4.25.3-

You can use the control rig graph in the first post, it’s working. Just search for “Control rig plugin”, it’s a plugin which is coming with the ue4 but it’s disabled by default.

Thank you for your advice! I will use it… but first I need to learn how it works (I’m really out of the new features since a few versions, but plan to get up to date on them xD). In the meantime, I managed to come up with a small workaround in blueprint making some checks. It’s not perfect, because visually there’s an small artifact but enough while I learn about control rig plugin.

scha, Thank you for working for it. it’s the exactly what I want but I cannot find out the “rotation order” like in your video Though I replace the AnimNode_BoneDrivenController source and header files. I’m working on the project using UE 4.26. It may be the version problem?