Animating rotation around local axis

I have an object that’s at a funny angle. I need to animate it rotating only around its local z axis. When I try this its animated rotation looks horrible. Specifically, the object in question is a rocket engine of a spaceship, visible here :
http://rhysy.plexersoft.com/Deep%20Space%20Force%20Gallery/slides/Hull%20section.html
The spaceship itself (which it is parented to) is rotating. Since the engine’s angle is not in line with any of the major axes, I can’t do ctrl+a since then its local axes aren’t suitable for rotation. The engine is not all one piece for texturing reasons; the nozzle is parented to the main mount. How on earth do I rotate this thing correctly ?

You can use the transform widget in local mode (activate the hand icon, select rotation control, select Local from the rollout menu). Or is the movement more complex than this?

Hey, it works ! Thank you very much ! :smiley:
I thought widgets were just a gimmicky way of doing the same things you can do with hotkeys. I didn’t realize there was any actual functional differences to them. Obviously I was wrong.

I used to hate the widget too but now I find it indispensable. You can even make a combo widget by shift-clicking on the Grab/Rotate/Scale buttons. Btw you can still use hotkeys to do what you want. R followed by Z will limit rotation to the global Z axis, R-Z-Z limits to local Z axis.

I know about the hotkey method, I use it all the time. It doesn’t seem to work properly though. Even when selecting “local” as the orientation, the RotX and RotY curves generated aren’t flat when rotating around the local z axis. I guess orientation is only used for widgets for some reason.

Didn’t it used to be the case that for keystroke local rotations you’d hit the axis letter twice - eg R,Z,Z ?? Or is my memory playing up again?

1 Like

Having the same problem here. I can rotate the object (in this case, an empty to which the rotating obect is parented) on its local z axis in the 3D view just fine, but when I go to insert keyframes, the IPO curves are only representing the empty’s orientation in global space! Thus, because the empty is at an odd angle to the global space, when I want to rotate it just along its local z axis, it does some loopy rotating because the curves are defining its global orientation! Dad burn it all, anyway! :mad: :mad: :mad:

How do I define just local IPO curves?

An example of what’s going on would help. However, if you’re only inserting keyframes for the z-rot ipo when you do a local z-rot, then you need to insert keyframes for the other rotations.

Aligorith

I would like to rotate (or spin) a shaft whose axis of rotation is not parallel to any global (world) axis. How would you do this? I’ve tried keyframing IPOs (all are global not local). I’ve tried parenting and track-to constraints.

This would work like a charm if you could just define the “up” axis on a track-to constraint to point at another object. Then one could track an empty to another empty following a circular path with the same “axis” as the shaft, and have the “up axis” of the tracking empty point to another that is located somewhere else along that same axis of rotation.

In the attached illustration (one of several situations where I’m trying to get this to work) I’ve got empty.005 tracking to empty.004 which is following the circular path highlighted. Now I just need to keep the y-axis of empty.005 pointing directly at emtpy.003, which is located on the axis (shown in blue) of the shaft. However, there is no way (that I know of) to keep empty.005’s y-axis colinear with the shaft axis.

Is there an easy way to do this with armatures? Or any other suggestions would be very appreciated!

Attachments


Local rotations were a problem for me, too. The only way I found to do it is to parent objects to armatures. You could create an armature with a single bone, parent the shaft to it, then rotate the bone in the pose mode. To keep the whole thing together, you could parent the armature to the rest of the model. Then when the model moves, the armature goes with it, taking along the spinning shaft.

Well, using the widgets as per CD38’s suggestion instead of hotkeys worked fine for me. You have to select “Local” in the orientation box though. Only seems to work using widgets and not hotkeys, but generates correct IPOs.

I just tested this with a plane, and it didn’t work. :confused: This is bizzare, because it 100% definately worked before.

Figured it out. Set everything up so that the object in question does have one axis pointing along one of the major ones. Then, animate its rotation along its local axis, using widgets as described. Now you can parent it to an empty and rotate the empty so that the object is in the correct position/location. More usefully, it is also possible to parent the object to the empty, rotate the empty, and then animate the object’s local rotation. However, I don’t think you can take an object that’s already been rotated to a weird angle (i.e. not pointing along a major axis) and then parent it to an empty, you apparently have to set the object’s global rotation via an empty before animating its local rotation.

Rhysy, yeah I had this frustration, too. I got it working in one instance, then nothing. I even got the IPOs to do what I wanted on another, but the moment I set cyclic extrapolation, things went to s**t and I couldn’t get it back.

Thanks for the tips on orientation. I’ll give it a try. This will likely be a pain, as the shafts are rotated from global axes at odd and unknown angles (imported geometry).

@grafix: thanks for the ideas. I’m still a little leary of armatures, cause to be honest, I’m not sure how the whole “pose mode” thing works just yet. My past (pre-2.4x) tinkering left me nothing but confuzzled about it. I’m nearly to the point of diving in, tho. (Usually the point at which you actually learn something and make a breakthru! :slight_smile: )

Armatures and rigging is a whole new can of worms, I agree. But I also played around with the same problem you’re having, and it seems that armatures are the only way to solve it. Think of the Pose mode as the local coordinate of the bones. If you manage to get the bone to rotate (set 4 90 degree rotation keyframes for the bone, set the IPO extend mode to cyclic) it will rotate continuously and maintain the proper orientation no matter how you move or rotate the Armature (in the object mode).
I think the problem you’re having is that while you’re able to rotate the object in the local axis with widgets, the IPO’s are working on the global coordinates, so incorrect results are given. I haven’t really been able to set local IPO’s for regular objects. The only thing I can visualize as “local” for a mesh is the Vertex keys. But you can’t do rotations in it… otherwise, it would be the thing to do (set the rotation in vertex (or shape) keys for all the vertices in edit mode)…
OK, here’s another idea without using armatures. It came from another topic just posted about bones and nurb circles. How about creating a curve circle, changing it to a 3d path, parenting an empty to it so that the empty follows the path, rotating round and round. Parent the 3dpath to the mechanism so that it goes with it, and use a track to contraint to the shaft so it tracks the empty? (Not really sure of the constraint type or if it will really work, just making crazy pictures in my head here…) But this is really a more complicated setup than the one using armatures. And then there’s the crazy problem of z flipping with paths and curves…

I’m thinking I’ll have to do it this way… is setting keyframes & IPOs pretty close to the same for bones as for other objects?

Exactly.

This is pretty much the same setup as I had tried & illustrated above (post #9) but with some empties involved to aid in alignment… my little setup didn’t work, 'cause one can’t control the “up” direction of a track to constraint properly. Mine came out all wobbly, I assume because it was trying to get as close to the global direction of the specified “up” axis as possible. I’m very surprised this hasn’t been fixed yet. It would be extremely handy in many situations, I’d bet. At the very least, add local xyz options in there!

Track-to constraint working on local? I’ll try to look into it, but don’t expect anything within before after this coming weekend…

Aligorith

Here is a simple .blend file using a bone to provide local rotation. You don’t even have to have the object parented to the bone or have any vertex group assigned. You can parent it directly to the Armature in the object mode. Also, I found out that you have to have at least five 90 degree rotations to get a complete turnaround cycle with the bone’s IPO. I guess that’s how a complete cycle is defined in quaternions…?
http://www.bestsharing.com/files/ms00190139/monkeycopter.blend.html
The monkey head is the base object. The propeller is parented to the Armature. The bone is rotating. The armature is parented to the monkey. You can adjust the speed of the rotation by changing the overall length of the cycle.
I also tried the path method, but can’t get it to work.
Would be cool if they could come up with a rotate modifier. Sort of like a continuously rotating empty with controllable and keyable speed and direction you could use to link your object with. Or another type of motion, such as back and forth plunger type action, etc. Would be much less work than using bones and more controllable.

grafix, thanks for the info. I set up the rotation with armatures (tho I did go ahead and assign all vertices to the vertex group.) I set up one 180deg turn over 15 frames and set it to extrapolate cyclic, and noticed it seems to oscillate in the resulting animation. I’ll try your tip on 5x90deg keys to see if that does the trick. Can’t access the blend, for some reason. Appreciate the help, tho! (EDIT: Oh, and if you can figure out quarternions, and offer an english translation, by all means, please do! :slight_smile: )

Aligorith: could the option be added to track to constraints to include an object in the UP x, y or z field? If you look at my illustration in post #9 above, the empty.005 that’s at the centerpoint of the highlighted circular path is tracking empty.004 that is following the path. As you can see, I’ve got the Y axis designated as “up”, but it does not keep the empty’s rotation from wobbling. If I could select the Y axis as UP and have a textbox to indicate empty.003 as the UP direction, this should allow empty.005 to rotate smoothly without wobble.

A much simpler (from a user’s implementation perspective) would be to simply allow IPO curves & keyframes to be either global or local. Simply setting a local IPO to the rotation around the Y axis of empty.005 would solve this particular animation problem, and many others like it! (I’m quite surprised that this is not already in there!)

I don’t know if people have given up on this already, but it seems that using dRot(x/y/x) uses local rotation, instead of just using Rot(x/y/z). You have to add it directly into the IPO editor with CTRL-RMB, though, instead of with IKEY.

Hope this helps.

Alitorious: thanks for that tip. I had tried to put in IPOs for the dRots, thinking that may be the case (what does the “d” stand for here?) but was unsuccessful - maybe because of your tip about adding them directly (can’t remember exactly what I tried, being blinded by rage at the time and having slept - read: brain reset - since then.) The armature thing worked great, was simple and quick. I was able to get a full 360deg with just four 90deg rotation keys, tho. Go figure.