How do i limit the rotation of an IK Constrained bone?

Okay here’s what i want:
I want to be able to set angle limits for how a bone can rotate, and i want the IK solver to look at those limits, take them into account, and find a valid solution that doesn’t break the limits, but still touches the target point if possible.

What i’ve tried:

  1. The Inverse Kinematics section in the properties > Bone panel


These limits are not working properly. The IK solver sticks within the limits, but fails to reach the target point most of the time. Based on experimenting i am fairly certain that what’s going on is that the IK solver is finding a valid solution without taking the limits into account, and then the limits are applied AFTERWARDS, breaking the already valid solution and causing a bone arrangement that stays within the limits, but does not reach the target.

  1. a “Limit Rotation” constraint in the properties > Bone Constraints panel


this constraint does not work with IK at all. Although it applies fine to objects that i directly manipulate, anything which is moving with an IK solver just compeltely ignores this constraint on it, and finds solutions that violate the limits

So this is where i’m at. How do i accomplish my goal? I thought this would be a very easy goal to do, and i was convinced one of these would solve it easily, but it doesn’t ;-;

2 Likes

so far i’m seeing some odd results with my Z constraint, it seems to work better if i set that at a higher value, even though it doesnt seem to turn on that axis

You cannot use other constraints in conjunction with IK. You need to use the built-in IK limits. They are in the Bone Data buttons, in the section marked Inverse Kinematics.

http://wiki.blender.org/index.php/Doc:2.6/Manual/Rigging/Posing/Inverse_Kinematics#Bone_IK_Panel

Generally though, it’s better to leave limits alone and use a pole target instead. This will prevent bending in the wrong direction, but allow more flexible posing for the animator.

1 Like

In other words, it doesn’t really work. Solutions are a variety of what amount to kludges and workarounds. “And then if you add two extra bones here, a Track To constraint, three empties, two extra shadow armatures and a script that worked in 2.49b, it’ll give the result you want…”

That’s an exaggeration but it is what it is and it works pretty darn good. Countless finished projects out there prove it. There is a lot going on in the code. It is many small tools working together as a rig. Either put it together as it was designed to be used or suffer the frustration of trying to create a frankenstein rig which will probably not work nearly as good in the end, if it works at all.

To the OP and a few others floundering around here the past week or so trying to get support while they wander way out in the weeds where nobody can help them. Watch the best tutorial! Humane Rigging is CC licensed and can be found with a quick search of youtube if you can’t afford to buy it or a subscription to the Blender Cloud. Step by step how it all works, how an FK/IK switching rig is put together, and step by step workflow of how to go about building one.

Watch the darn tutorial! You don’t even have to follow it. Just sit through it once and you’ll be miles ahead of where you are today. Then your questions will be easy to answer when you do get stuck (click this button here, roll this bone, look in this panel) and you’ll be creating custom rigs and fixing broken rigs like a pro within weeks if not days.

Just some friendly advice that’s all. This stuff really isn’t as complicated as it seems. It’s just confusing with all the bones on top of bones parented and constrained together every which way.

-Larry

That is fair enough Larry. But maybe there would be fewer people asking lame questions and wandering around in the undergrowth if Blender were a bit less frustrating due to its foibles. It is a great program. But it has some issues. The OP has indicated one- the bone constraints don’t function properly with IK. I’ll give another. I have a little rigid body sim running on the figure I am working on, controlling shape keys. Every time I change something, the cache goes out of date and needs recalculating.

That’s no problem. What is rather silly is that the only way to get the cache to recalculate is to edit a value (I normally edit gravity, I’ve got a virtual reflex now for typing “-9.81”). Otherwise the cache just sits there, out of date, with “recalculate to frame” greyed out because it thinks it’s fine. And, as a n00b, it took me quite some Googling initially to find out why my little cube on a spring was getting stuck in the wrong place. It’s this kind of thing that has us lamers asking so many questions, annoying the pros, then getting p’ed off and giving up.

Listen to Larry, please. Have a nice day. :slight_smile:

I doubt it, and the questions you mention aren’t lame questions. How do I make this screwed up rig work is a lame question if you ask it after ignoring great advice.

My comment was based on the story behind the OPs questions. It was advice to him and others who may be wondering why they aren’t getting great response to their questions and/or having great difficulty making this stuff work. We can only help people help themselves.

Edit: I should have posted this days ago in an earlier thread. OP is well on his way now I think. My advice still stands. You know who you are.

-LP

In other words, don’t use other words to tell me what I said. Listen to what I actually said instead of making up other words. I said specifically not to use extra constraints, bones or scripts. An IK chain with a pole target is the most user friendly and simple way to get a chain to bend in the direction you want without jerking and popping. It’s the way the IK constraint is designed to work; there’s a field for a pole target right there in the constraint settings. I don’t know how you think filling in the expected fields in a constraint’s settings is somehow “extra.”

IK limits are good for some specific cases, such as mechanical rigs where you’re using IK for some sort of gearing, but for the case of regular knees and elbows they are usually not really appropriate. In animation you often need to break normal limits of bone rotation to get good looking motion, so it is best to leave as much flexibility as possible while still getting things to point in the right direction. That’s why I recommend pole targets over IK limits. They’ll keep the knee from bending backward but still allow you to get into the poses you need when the time comes. I should think the people in this thread have already seen this in another recent thread but I’ll post it again for you to examine: Mr_Genericlegs.blend (414 KB)

oh this thread is still going. hey guys.

I eventually solved my problem. It turns out that i hadn’t set my pole target angle correctly, and the knee was pointing off to the side of it. As a result of that, it was being forced into odd angles on it’s Z axis far more than it should have been.

Now, in order to set pole targets, i put a temporary Pointing bone at the knee/elbow, parented to the lower bone (shin, lower arm) and i adjust the pole angle until this bone points exactly at the pole target

Once the pole target was set properly, the angle limits started working much more sensibly

Also i’ve found that any time i change the chain length on an IK chain, the pole target gets screwed up and i need to redo it. So i keep those pointing bones around on a seperate armature layer.

K Horseman-

Apologies, I did not intend to put words in your mouth.

I do think it’s interesting how simple animations need a whole suite of solutions on the same figure. I was trying to think of an interesting animation to try, and ended up yesterday spending time seeing how people get from standing up to hands and knees; and practising for myself, I found that you first squat down, then tip forward onto your knees, then forwards onto hands and knees. And that’s quite hard with one rig.

For the first stage, standing then squatting, the fixed point is the feet, and you’d have IK with the two bone thing to keep the feet stationary and pole targets on the knees. Once they’ve tipped forward onto the knees, the knees become the pivot point and the feet want to be free. Then when they’ve tipped again- pivoting at then knees- onto hands and knees, now you’ve effectively got a quadruped whose IK wants to be on the hands and knees- and whereas with “Foot IK” you want it to stop at the thigh/hip joint it now makes sense to have the hips part of the IK chain to get the extra degree of freedom. And if they then roll over onto their back, the back or butt now becomes the imaginary fixed point. And so on.

From reading various internet things about 3D animation, not just Blender, these transitions- from IK to FK, and anchoring things like elbows on tables, all seem to be a bit of a challenge. Heaven knows what the right rig for a break dancer would be :slight_smile:

It seems naively what one wants is to have in any armature the power while animating to arbitrarily fix in space any bone or joint and redefine IK chains “on the fly”. I’m presuming the easiest solution in lieu of that is to have cuts in the video between camera angles, switching rigs at those points.

You can always switch active armatures and meshes from one frame to the next - in fact you can do a whole lot of stuff from one frame to the next that would never show up in the final render of the animation. I have tried such devious practices to great effect!

Cheers. Clock.

I was working on a switchable IK chain a while back. Maybe I can dig it up. I was trying to set the knee and elbow as targets for situations just like you described, jaxtraw.

Try to do a crawling animation with hands and feet as IK targets gets pretty frustrating. (FK is much worse.) By making the knee and elbow a target, it becomes trivial. The forearms/hands and shin/feet become FK after the knee and elbow IK targets. The only tricky part to the rig involves the hips. You can only have one leg have control over the hip, so you need to decide which side has the “weight” of the character. Then you need to switch it for every movement.

Still, it’s better then all of the counter animation you need to do with a regular IK or FK setup.

Dan, it just surprises me that animators haven’t formulated a simple stable solution to all this long ago. The more I can’t help thinking about it, the more problematic examples occur to me. Imagine a character walking into a bar, “hotching” onto a stool, then leaning on the bar; the desirable physical anchor points on the skeleton shift each time. I think what has surprised me is that naively I thought that the process would be: create a mesh, then give it a rig, then, “get animating!”. Instead, it appears to be create the mesh, decide what you want to animate, then try to assign the right rig, so you never have a standard rig for the mesh as such. “This is Walking Fred, this is Dancing Fred, this is Crawling Fred, this is a Fred That Can Do A Headstand” and so on.

So really, for 90% of the time, it’s not like one really wants an IK of some bone and its friends following another bone. The IK target applies to some joint, and you just want to be able to pick up that joint, move it, then fix it in either local or world space. But you can’t do that, at least not easily.

Seems oddly clumsy to me. I’ve read discussions between animators about the transitioning from IK to FK, manually aligning the bones of the two rigs. If I were making a living at this and I’d had to do that just once, I’d be back onto the software dudes saying, “I can’t spend all day manually aligning rigs. Give me something better”.

Well it’s not the animators fault, it’s the riggers. I know what you are saying and I thought at one time it should be that easy too. Having used lesser programs that had horrible IK setups and basic, no frills FK setups, I can say that what you are suggesting is at least possible in Blender. That’s why I am here to be honest. I was not getting the results I wanted, with the ease of use in other programs.

FYI, if you use the Rigify rig, it has built in FK and IK snapping. One button click to align and switch between them. I should make a tutorial on the rig controls someday. People often overlook the features or do not understand how to use them.

You can actually limit your bone’s rotation
When you apply IK constraint, every bone related creates it’s own Inverse Kinematics menu

PS. People like Larry are dam boring
Never be afraid to ask questions, even stupid ones