constraint & driver / matrix confusion


blend file: http://www.pasteall.org/blend/33072

so all green bones have the same assortment of driver and constraint. The circled one loops out after 90 degrees. Is there a reason for that?

The vertical bone is the control bone.

I have your blend file - I am moving the control bone around within the bounds of the others and they flip up slowly as the control approaches. Is this what should happen? If so, I cannot see any errors, other than; why have you put rotational constraints in World Space rather than Local Space? the bone circled is the only one who’s X axis lies in line and is oriented to Global X. I have changed them all on my version to Local Space for the constraints and they all appear to behave the same as I move the control bone around, both inside and outside the area bounded by the other bones. If I am missing something or am not operating it correctly, please advise.

Changing the circled bone rotational constraint to either Pose Space, or World Space, causes errors in movement of the circled bone as you move the control bone in Y beyond the bounds of the other bones. Therefore I think this is where your error lies.

On further investigation: If you move the control bone -4 in Y the rotation for circled bone is actually -224.183 degrees, which is of course limited to 0-90 by the constraint, so it is actually turned vertical and will stay there until it is back in the 0-90 range where it will either flip back to 0 or slowly climb to vertical again. I presume you are aware that all Driver Rotations are in Radians, so a movement of 2 * pi of the control bone results in a full 360 degree rotation of any of your bones, and a movements of 1 in any direction causes the bones effected to rotate 1 / (2 * pi) Radians or 57.291 degrees (if pi = 3.1418, also you have set the bones to have an initial rotation of 1 degree in your Active Keyframes, so it will actually return a value of 58.291). Further, a movement of the control bone in one axis of 1.5709 will rotate any effected bone by 90 degrees or (2 * pi) / 4 Radians, assuming it does not cross the -180 to 180 boundary. To make it rotate 90 degrees for a movement of 1 of the control bone, your Driver Scripted Expression would be -(var * 2 * pi) /4.

Is this what you intended for the rig?

Answers, with all mathematical calculations, on my desk by 09:00 sir! :slight_smile:

Good evaluation clockmender.
Seems its best to use local space for the bone constraints.

Heres a modified example: http://www.pasteall.org/blend/33089
You may want to change the driver keyframes Frame value.

To solve repeating rotation problem, for the driver fcurve, set the keyframe interpolation to linear, and the channel extrapolation to constant.
If you set the drivers fcurve keyframes correctly, you shouldnt have to use Limit Rotation bone constraints.

For the drivers, probably best to use Transform Channel driver variables, X Location, Transform Space.
Local Space will cause a bad dependency graph update in this case.

Btw, for driver keyframes, the Frame is always a radian, the Value is determined in the Properties > Scene > Units panel.
I guess the docs could be updated.

Thanks dirty-stick. I hadn’t got as far as making it more efficient, just solving the issues. I have taken your amendments and will look at them to improve my knowledge.

Upodate

OK have looked at your amendments and I agree with your methods 100% Thanks.

that sure is of interest.

Um thanks for the math. It does become verifiable after some looking into.

Essentially one unit in Blender distance equals 1 radian per transform. Although be it looks to work identically for both only var and -(var * 2 * pi) /4 within dirty-sticks’ file.

No matter the rotation blender always calculates in radians for the whole software. Not sure about displaying it thus though.

As for the matter of intent behind the rig. It was really just supposed to hinge a box in all directions. Limits is something I’ve never addressed with drivers.
Thanks for the time and update of file. That scripted expression will come in handy.

very robust

Accepted. My point was that if you want to rotate anything by N degrees, your scripted expression must be (( N / 360 ) * ( 2 * pi ) ) multiplied by some variable to achieve a gradual rotation based upon something else moving - that works every time and in all circumstances. You can always make life easier by moving the conversion to radians somewhere else and I left the expression in basic expanded form rather than simplifying, so it shows how I arrived at the maths. I am pleased you got it sorted.

Cheers. Clock