How to change bone roll after "track to" constraint? Gimbal compensation?

Hey all,

Having trouble trying to figure out how to change a bone roll after I applied a “track-to” constraint, or some other solution to solve this.

I have a widget bone pointing in a certain direction. Another bone is point towards its tail, by using a track-to constraint.
But the z-axis of the object bone is wrong.


The problem is that I want the bone’s z-axis to follow the direction of the widget bone’s y-axis OR to have the object orient itself along that axis. But there’s no way to override the effect of the track-to constraint as far as I can tell.


Does anyone know how to solve this?

TIA, T.

Change the “Up” axis on the constraint, is the simple answer, I would need to see a blend file if this doesn’t work.

Cheers, Clock.

Hi Clockmender, thanks for you reply.

I doubt axis orientation is the issue in this case.
I think this has something to do with Quaternions vs Gimbal of a bone roll.

Here’s the blend file (cleaned up, but still messy, sorry): test.blend (667 KB)

Suppose the arm is positioned parallel along the y-axis and you look perpendicular at the y-axis (numpad 1). Then if you move the control bone around, the ‘extruder’ object rotates along its local y-axis from 0 to 1 (Quaternion).

The problem becomes obvious when you look at the bone Roll in Edit Mode of the Armature. The bone roll is Gimbal, going from 0 to 360 for a full rotation. If Track-to constraint uses Quaternions for calculations, something strange is bound to happen.

So I have to figure out how to compensate for this somehow…

Any suggestions would be appreciated!

T.

The bone “CTRL-Extruder” has a Track To constraint with “WGT_Pivot” as the target - this is causing “CTRL-Extruder” to rotate as you move it around. This in turn is causing “Extruder” to rotate in a way that perhaps you do not want. Simply disabling the Track-To on CTRL-Extruder" stops this happening and makes “Extruder” behave in the way I would expect.

I also changed "Extruder “to be YXZ Euler rotation, since it is the Y axis that should be actioned before all others, this action also makes the behaviour more consistent, but not really noticeable with what you are doing with it just now, it may in the future be noticeable. Also in Edit mode, bone CTRL-Extruder” lies co-axially and incidentally to (on top of) “Extruder” - consider moving it away along the Y axis of “Extruder” to make the behaviour more consistent, currently if it is left in it’s Edit mode position, it will make the Track To constraint work in a peculiar manner.

You are also in danger here of having cyclic dependencies, you are not there yet, but could easily end up that way. You should avoid having one bone’s behaviour dependent upon another, whose actions are dependent upon the first - that is a cyclic dependency error. If you want bone A to track another bone B, try to make sure that the bone B is not also subject to unpredictable behaviour, like being rotated by a constraint it has, since this will be transmitted back to the bone A.

Is there any particular reason why you have the Track To constraint on bone “CTRL-Extruder” with “WGT_Pivot” as the target?

Hope this helps you!

Cheers, Clock.

Hi Clockmender, thanks again for your efforts.

I agree the set up could cause cyclic dependencies, but the Track To constraint with “WGT_Pivot” on “CTRL-Extruder” was an experiment.

Imagine a plane defined by the following three points:

  • WGT_Pivot
  • Extruder tail
  • CTRL_Extruder

I want the ‘extruder’ object’s local z-axis to ALWAYS remain parallel to this plane, regardless of how I move the CTRL_Extruder bone.

Conceptually that’s really simple and I thought this set up would adjust the bone roll correctly, but it doesn’t.

As far as I can tell, the bone roll changes according to ‘Gimbal’ orientations, not Quaternion, so off by a factor 2. This is easy to compensate for in 2 dimensions, but in 3 dimensions, it’s giving me a headache…

(I’m guessing that if I could write a script to change the bone roll of the Extruder bone by the correct factor, it would work…)

I can’t find a way to keep two bones parallel to each other if one is tracking the other with a Track to constraint. The bone roll seems to have a life of it’s own!

T.

Aha! - then you would not want to use a Track To - oddly enough.

What you do is to have a bone from one point on the plane going to the end of you “Extrude” bone, parent Extrude to this bone and make it inherit rotation. Then add an IK constraint to Extrude with the Control bone as the target. For the link bone you then lock it’s X and Z axes in the Inverse Kinematics sub section of the bone panel:


BTW - If you have an IK constraint ALL others are ignored, like Copy Rotation, etc. Also the normal bone Transform locks are ignored.

Then simply move the control bone around and it all stays in line. In the blend file below I have raised the end of the link bone above the “Pointer” bone by rotating it 10 degrees about it’s head, then rolled the pointer 80 degrees so it’s Z axis is in line with the “Plane” of which you spoke.

bones-1.blend (454 KB)

Just move Control bone and you should have what you want…

Cheers, Clock.

Hi Clockmender, I can tell you like a challenge, haha!

Tried IK before, but it causes the same issues (more or less).

I can get everything to work if the arm is aligned to the y-axis (even with Track-to), but if the ‘link’ bone of the armature (using your blend file) is put at an angle, the ‘Pointer’ bone twists and causes the intended alignment to fail.

In my final rig, the Arm (‘link’ in your set up) bone’s position and orientation can be changed, so it would still be a problem.

I guess this really isn’t as easy as it seems…

Leave it with me - I am fairly confident I can do this, but it will not be tonight.

Cheers, Clock.