Help needed in understanding something about IKs!

I have a simple yet extremely annoying problem. It seems that I can’t figure out how to limit rotation of IK bones. Can someone show me a simple way to rig something like this turret here:

http://img102.imageshack.us/img102/4637/ketutusqr4.th.jpg

I’ve been battling with it for hours and hours and if I don’t manage to figure this out I’m going to throw my computer out of the window and pour gasoline on it and set it on fire. :mad:

What I want to do is to have one bone for the horizontal rotation(the base) and one for elevation. I want the elevation bone follow the horizontal rotation bone(I got this part working, but not the rest).

I hope this makes at least remotely sense. I tried to search the forums, but couldn’t find anything useful on this topic.

Since this rig is pretty much straightforward, it’s hard to understand what kind of problem you might possibly have.

Insert an armature, extrude the second bone. Position the bones as you see fit.

Simple(st?) solution:
-> Turn on AutoIK for the armature.
-> Change to pose mode.
-> Position the bones in Pose Mode and save the Ipos for Position and Rotation.

What could possibly go wrong with that?

I have it partially working.

http://www.4shared.com/file/5484224/6b8cfcf5/tank.html

Couldn’t figure out how to completely lock out the X rotation though.

Mike

FWIW, it surely isn’t worth using IK for a simple system like elevation/rotation?

The way I’d try and do it is probably not even to use an armature. Put a copy rotation constraint on the base, and target it to the turret itself. Deselect the XY rotation, so it only rotates in the Z axis. Then you can rotate the turrets both in Z and in X/Y, and the base will follow.

Alternatively, if the turret is made up of lots of objects, use a single-bone armature. Parent all the objects in the turret to the bone, so that it controls the turret directly, then, as before, Copy Rot on the base to that bone.

I’d have to agree that IK seems a little odd for something which in reality is FK driven. The guns and turret would only ever be IK driven if the tank crashes into something.

You could use transform locks (N-Key on the bones) to prevent the objects rotating on the wrong axes. You can lock location and scale transforms while you’re at it for added security.

The only advantage I can think of for using IK is that you could apply IK rotation limits to prevent the guns rotating too far. To do this, you have to understand that rotation limits apply at the joint so you could use one short vertical bone which controls the horizontal rotation of the turret (rotate on Y axis, lock the X and Z) and one bone extending from this to control the guns. Set the rotation limits on the gun bone so it only rotates within a selected range on one axis (X or Z), lock the other two axes. Parent the objects to the bones.

You may also be able to achieve good results with IPO drivers?

It definitely looks like a job for action constraint.

What about tracking the gun to an empty?

The more I read the more I realize how much I still need to learn. :o Mike_S thanks for the .blend, I’ll probe it out throughly once I have some time.

For some odd reason those transform locks have managed to stay under my radar for all this time. I feel blind. :smiley: But thank you for pointing them out.

AndyD can you give me a brief explanation on FKs or better yet link me to a good tutorial on this area?

I should’ve stated in the beginning that I’m a complete animation newbie despite all the reading I’ve done in the area(Blender tutorials mostly), so please be patient with me. :smiley: Explain it as if you were explaining it to a young child. I’m a bit slow on the upper department at times. :stuck_out_tongue: But thank you for your time nevertheless.

Saxofoner can you elaborate. It sounds like a method that’s going to save a lot work later on.

I usually explain it something like this.

If you raise your arm then bend your elbow you are driving the rotation from the roots of the joints. First your shoulder joint rotates to raise your upper arm, taking your lower arm with it, then your elbow joint rotates to move your lower arm. Your hand goes along for the ride and its final location depends on how the joints above it rotate. This is FK (Forward Kinematics) because the motion is driven forwards from the root of the bone chain to the tip.

In IK (Inverse Kinematics) the motion is driven from the tip to the root. For example, if I grab your hand and forcibly move it up near your head - this will cause your elbow and shoulder joints to rotate as a result of your hand being moved. Your hand goes where my hand tells it to go and drives the rotations up to your shoulder. This is why traditional IK uses targets - they are what determine the positioning of the end bone and Blender does it’s best to rotate all the other bones into a logical position with respect to any other constraints they have to obey.

FK is the default so it doesn’t really need much of a tutorial, it’s pretty intuitive. Rotate one bone, rotate another and so on until things are how you want them. Except for the root bone in a chain, the bones can’t be “moved”, only rotated (and scaled). This is why I think FK is all you need for your guns.

As far as I can see, you could probably just do this with parented objects and no bones. Just move the centre of rotation for the gun barrels to the pivot point at the base. If you want to use bones I think you only need two bones in an “L” shape (or upside-down “L”) with the joint at the base of the guns. Parent the turret to the vertical bone and the guns to the “horizontal” bone and use transform locks to prevent wrong rotations.

A Track-To constraint would be useful if it really matters that the guns point at a specific target - otherwise it would probably be more effort than its worth.

As ondrew said, you could also use Action Constraints to make predetermined animations that can be controlled in varying degrees by moving a “lever” or something as you do the real animation.