Animating Bones 360 Degree Rotation?

Ok I ran into this problem a while ago while animating a flail for my game, but I finally figured it out by manually rotating for every single frame (which was a huge pain). But just now I was messing around with direct mesh animation, and I saw that you can rotate it easily past 360 with no problems, so what’s up with bones? Why the glitching out when trying to rotate 360 degrees or more? and is there a fix? Thanks.

From what I know, there isn’t any prob for rotating a bone past 360. A prob could occur if you have some constraint on you bone, like a track to, a spline IK or other constraint that require an Up.

Mathias.

If you try to rotate 360 degrees with two keyframes like at 0 and 20 it won’t rotate at all, if you do it with three, like 0, 10, and 20 with 10 set to 180 degree rotation, it rotates the correct way up to 180 but then reverses direction. Which causes many problems.

I’d have to see the files your playing with the fully understand what you are doing, but I think I know what your problem is…

If you have lets say hands of a clock, and the minute hand is at the 12 o’clock position, and you rotate that hand 360 degrees, it’s still at the 12 o’clock position, so how do you know it even moved? The hour hand has moved ahead an hour in the real world so you know it moved. In blender’s world, if you rotate that hand 360 degrees, it hasn’t moved at all, it’s still at the same position as it started at.

In the case of rotating 180 degrees, then another 180 degrees and the rotation reverses itself is how it works in blender. Blender doesn’t know to keep rotating in the same direction as the first rotation. Rather than research this and find the exact answer, (I have in the past, but didn’t bookmark the webpage describing why & how) consider this: I tell you to rotate something 180 degrees, how do you know which way I want it rotated? Clockwise, or counter-clockwise?

To achieve 360 degrees of rotation, you need 5 keyframes. 1st keyframe would be the starting point or 0 degrees, 2nd would be 90 degrees, 3rd would be 180, 4th would be 270, 5th would be 360. To see this, insert 3 keyframes like you described on the default cube and switch a panel to an f-curve editor and view the animation curve, you’ll see the first and third keyframes are at the same point. Try it with 5 keyframes and then look at the curve, you’ll notice it’s different. Basically, this is how it works in blender and once you learn that, you’ll know how to do it and it’s not a problem.

I think mathiasA has experience with other 3d packages, perhaps he can tell us if it’s different in other applications…

As a side note, this is why you can’t use a copy rotation constraint to animate gears turning. Say you keyframe the first gear to rotate 360 degrees with 5 keyframes then try to use a copy rotation constraint on the 2nd gear, it will fail and rotate backwards 1/2 way thru the rotation. For a case like this, you need to use drivers instead of constraints.

Randy

Edit: I’m still rendering, so I looked it up…

1 Like

You can rotate a bone 360° along an axis with only two keyframes if this bone is in “Euler rotation” instead of “quaternions”, just create a rotation keyframe at the first keyframe, go to the next keyframe and enter 360 in the rotation field for the axis along which you want to rotate and create another rotation keyframe. You can enter -360 in the rotation field depending on which way you want to rotate.

Now as regards the five keyframes method with quaternions, I’ve already had a problem : you create your four first keyframes and when you create the last one, the bone rotates three quarter turn on the wrong way to reach the fifth keyframe pose. In this case I’ve never found a simple solution to fix the problem, you need to create some more keyframes which makes your animation uselessly complex or you need to tweak some rotation curves in graph editor on quaternion values which are not that easy to understand, in my opinion.

After reading sliv’s reply, I had to try this out. I created a single bone and parented the cube to it. Set 5 keyframes like I described, and had no problems at all with quaternion rotations. See attached .blend. So I tried this:

Which I know I had problems with before, and this time, no problems either. I also tried copy rotation constraints for gears, which I know caused problems before, and this time again, no problems… I also tried using euler instead of quaternion rotations for the bone example, and again, no difference.

All my tests where done in blender 2.61, so I may look for an older version and see if I have problems like I’ve had in the past.

Osmiral, could you provide a .blend file that fails on rotations with 3 keyframes so I could look at it?

Randy

Attachments

Bone_Rot.blend (404 KB)

I usually just make sure my F-curves all have the proper slope for the kind of rotation direction needed. For a consistent rotation direction, the curves have consistent positive or negative slope, so it’s easy to control the rotation direction regardless of the number of keyframes, or how many changes in actual rotation speed actually occur.

This is particularly handy with objects that need to rotate past 360 deg. If you just grab your object and rotate it 720 deg, Blender will not recognize that as two full revolutions. This can be a problem if your object is already past 360 and you rotate it some more, then keyframe – the rotation value will be “normalized” to between 0 and 360, an unwanted result. The slope of the F-curves will show this, and you can correct it there as well. Entering values in the Properties>Transforms fields will also allow keyframing rotation beyond 360, but it isn’t as intuitive as using the manipulator.

Thanks everyone for the great and detailed responses. I’ve learned quite a bit more about how this works. It seems I was wrong and you can actually do it with three keyframes, it only breaks if you set the first and last keyframe first and then set the middle one. Thanks everyone for your time and help!

As I said, entering value is easy when you use euler rotation, but I think it’s more complicated with quaternions or maybe you understand them better than me. For example, with quaternions, what do I need to enter in which field (W, X, Y or Z) to get a 360° rotation along the X axis ?

A thing that can cause the problem I described, the wrong way three quarter turns rotation, is using copy/paste pose to copy the first frame at the fifth frame. Obviously, using copy/paste pose on a one bone rig is absurd but it could be useful for a real character rig.

I don’t understand quaternions values at all, just basically understand what they are. I’ve read up on them quite a bit, but to be honest, the math is a bit above me. In my example I created by just hitting r-key in the 3d view, entering 90 on the keyboard and inserting keyframe, then repeat. For any animation where I think I’ll be needing precise control of angle values in the graph editor, I’ll switch the bone over to eulers so I can make sense of it.

As a side note, I really think eulers can safely be used almost all the time, I have only ever actually seen 1 case of gimbal lock before and it was a case of trubleshooting someone else’s .blend file on this forum.

But this method:

Would produce the results you described. If the final frame is copied and pasted from the first frame, then the last keyframe hasn’t rotated at all. So it would indeed rotate 3/4 of a turn then turn backwards to the starting point because that’s what you’ve told it to do.

Randy

Of course but the weird thing is when I make a 360° rotation by rotating the bone in the 3D view I would told to do a full rotation and it’s not what happens either.
Anyway, when I animate a character doing a back flip (a case for which I had the problem) I wish I could copy the take off pose keyframe to create base for the landing pose (the character does a 360° rotation) but unfortunately I can’t.

I’ve also read some documentation about using quaternions for rotations in 3D but it’s a bit hard to understand, the most important thing to know, in my opinion, is the X, Y, Z values for quaternions have nothing to do with X, Y, Z axis and these are not the values themselves which “count” but the ratio between them. For example, W=1 X=1 Y=1 Z=1 “equals” W=5 X=5 Y=5 Z=5
Anyway, that’s a bit frustrating using something quite often when you can’t understand how it works.

When I used Lightwave, I used to animate with euler rotation and I remember that gimbal lock happened quite often. Anyway, I think, the problem when using euler rotations is not only gimbal lock, but sometime, when creating keyframes with euler rotations, it appears that the interpolation between these two keyframes is a bit weird (like if the interpolation was not the “shorter way” between the two keyframes).

As I mentioned, turning an object through 360 or more with the manipulator does not result in the rotation being keyed at 360 deg or more – it is “normalized” to a value between 0 and 360. I don’t know exactly why this is the case but it happens consistently. To get a full >=360, you have to enter the value in the Transforms field and key it there, or edit your F-curves and make sure the slope is correct. These are the only ways I know to get “additive” rotations beyond 360 deg.

Actually you can as long as you edit your duped pose values to reflect the additional 360 of the rotation. Remember, 0deg != 360deg (for non-scripters, “!=” means “does not equal”). The pose may look exactly the same, but it’s been rotated those additional 360 deg, so if you want the figure to actually rotate you have to give the end pose its proper rotation value.

Rotating an object (or a bone in our case) more than 360° in the 3D view results in a more than 360° rotation as long as your object or bone uses euler rotation instead of quaternions rotations (you can do a test) I just say it’s a pity that we can’t do this with quaternions rotation but I’m not a coder at all, maybe it is “mathematically” impossible.

Now as regards the “back flip” example, I know I need to edit the second pose, that’s obviously how I solved my problem but I’m not sure, in this case, that the copy/paste pose feature still makes sense.

I think this is one of the better explanations of quaternions I’ve seen. From what I have seen, with quaternions 0 = 360 degrees. Actually, you can’t rotate more than 180 degrees with quaternions in one single step or keyframe. If you rotate 270 degrees and insert a keyframe, you’ve actually inserted a -90 keyframe. And from what I can see, with quaternions, 0 = 360 degrees. But it is possible to rotate more than 360 degrees with quaternions. Like in my example where I used 5 keyframes to achieve 360 degrees, 450 degrees (a full turn and a quarter) requires 6 keyframes.

This is how I cope with quaternions, 1/4 turn increments. In the case where you want to rotate forever, thinking like a helicopter rotor blades, you’d have to use eulers. Quaternions set to linear extrapolation can never achieve a full 360 degrees of rotation. In this case eulers would have to be used.

Randy

Thanks for this article.
I totally agree about the helicopter example, in my opinion, mechanical movements or those for which you need to disable one or two axis are the cases where I use euler rotations myself.

Hey, you’re right, I guess the problem with >360 deg rotations (even in Euler mode, which used to be the only mode for objects) has been fixed now. I had many issues with this in earlier versions, it became my standard practice to work around it, never really expected it to act differently. Happy to see it’s been fixed, my impression about it in earlier versions was “it ain’t a bug, it’s a feature.” :wink: