Page 1 of 2

Target Constraint: How how do you change direction of IK?

Posted: Mon Sep 08, 2014 2:43 am
by Greenlaw
I'm using a Target Constraint for a character's feet but I noticed that once a Target is activated, the IK will only bend in one direction. Exactly what determines the way the IK chain will bend after activating the Target? More specifically, can I rig this so I can change the direction of the bend when I want to? When I'm not using the constraint, the IK allows me to freely change the direction of the bend, so it seems like this should be possible. I looked through the manual and tutorial but can't find any information about this behavior.

For example, if you look at the Pirate Girl scene from the Content, the Target Constraint bones will bend the left knee to camera left and the right knee to camera right. How would you change/keyframe this behavior so that both legs bend to the right or left?

In my case, both of my character's legs are bending to the right. After making a body turn to camera left, I need the legs to bend to the left but the rig continues to bend both knees to the right.

Thanks in advance for any helpful info.

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 3:32 am
by Greenlaw
I did a little test here I rotated the direction of a child at the end of the chain. I'm finding that if I change the direction of the child, I can sometimes influence which way the IK will bend further up the chain using the Target Constraint. I'm not sure if this is actually doing anything though since it's not behaving consistently. Back to the drawing board.

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 3:38 am
by Greenlaw
Okay, it seems like when I over-extend the IK by moving the Target away from the rig and then rotate the child to either side of the chain, I can reliably change the IK direction when I bring the the Target Constraint back in to bend the chain. Is this how it's supposed to work? This seems a bit awkward when animating a character. Is there a more direct way to switch the IK direction?

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 3:53 am
by Greenlaw
I guess I could build a forced over-extension for the Target and rotation of the child bone into the SmartBone that changes the leg direction, but that really seems awkward to me. Not sure how it will look in animation--will give it try tonight though.

If anybody has a better idea for this, please post. Thanks.

G.

Re: Goal Constraint: How how do you change bend direction of

Posted: Mon Sep 08, 2014 5:22 am
by synthsin75
Without seeing the actual rig, I would think that you could simply "pre-bend" the knees when you turn the character. The IK should follow the direction of least resistance.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 5:48 am
by Greenlaw
That's what I would think--it's how it works in the 3D programs I animate in. Anyway, in my situation, I don't want the IK to be locked into bending in one direction all the time, I want the flexibility to change the direction of the IK when needed.

There is always this freedom to change IK direction when you're not using a Target Constraint, even with a pre-bend set in the rig. But once you activate the Target Constraint, it always wants to bend in one direction and it's not always the direction you might want. As described above, I figured out how to change the direction by over-extending the Target and then changing the rotational direction of a bone at the end of the chain, but I think what I stumbled on is a workaround solution and not necessarily the proper way to do it. (I'm still assuming there's a 'proper' way.) :)

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 7:24 am
by Greenlaw
Just for kicks, I just did a test where a SmartBone was used to alter the direction of the pre-bend of the chain. Unfortunately, this doesn't work at all--when I throw the SmartBone switch to change the pre-bend in the bone chain, the Target Constraint stops working completely. I think the Target actually getting 'locked up' because the new pre-bend is preventing it from moving the direction it wants to go. If I set the switch back so that the 'pre-bend' goes back to it frame 0 state, the Constraint works again but of course it only bends in one direction no matter where I position the Target. If I disable the constraint, I get back the freedom to bend the IK forward or backward, but of course then I lose the ability to lock the feet in place.

For now, over-extending target with rotating the end bone appears to be my only option. I'm not sure that's going to work once we start animating our scenes with it though.

Okay, to be honest, that's not the only option: we can absolutely animate and reframe our scenes to avoid the problem all together. But it's a puzzle and I'm a sucker for a good puzzle. :)

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 7:52 am
by Greenlaw
Nah, the over-extended Target and rotating child bone trick is not working reliably.

After applying this to an actual character, I'm finding that it only works about half the time. I can get the character artwork to properly turn to face the other direction but I think I'm going to have to make a duplicate set of leg art and bones that will bend in the opposite direction that I can swap to when I need to animate in that direction.

That and simply avoid animating this particular motion as much as possible. :)

Just to be clear, I'm only having this problem when using Target Constraints on the legs. The arms have a pre-bend that changes when the character turns and it bends in the new direction perfectly. The difference there, however, is that I'm not using Target Constraint on the arms.

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 1:02 pm
by synthsin75
If you want to PM me a link to the rig, I'd be happy to help puzzle over it.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 2:23 pm
by Víctor Paredes
By default, the IK uses the angle the bones have in frame zero, but you can change that anytime you want.
To change the direction, you must rotate the calf bone (or the one with the target assigned). To avoid the bones fast jumping from one direction to the other, you must put keyframes in between.
Check this video:

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 4:28 pm
by Greenlaw
Wow! Thanks for the fast responses guys, and especially to Selgin for creating the video demonstration! This forum has been an incredibly valuable resource. I'll study the video in detail this afternoon.

The popping calf bone was indeed an issue I ran into yesterday. I kinda understood what was happening but I didn't know how to deal with it. Your solutions for moving the knee around smoothly, especially the one for the 'crouching' position, is brilliant! Also, thanks for explaining that it's the bone that references the target that must be rotated to change IK direction. In my test, I was rotating both the 'thigh' and 'calf', which might have been amplifying the popping problem for me. I had also tried rotating the 'foot' to change direction but, as explained above, that was not a reliable 'switch'. Knowing there is a specific bone that influences IK direction is a huge help. (If it's not already in there, I think this info should go in the manual.)

Thank you both for sharing your knowledge! :)

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 7:20 pm
by Greenlaw
I just now applied to the technique to a final rigged character and the 'switch' in the knee IK works perfectly!

Thanks again for the tips! Now Alisa and I can animate and frame our scenes the way we boarded it. :D

G.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Sep 08, 2014 11:10 pm
by Víctor Paredes
I'm happy to help. I'm not sure if this specific topic was covered before in the forum, so I thought it would be nice to have a video showing it :D

Re: Target Constraint: How how do you change direction of IK

Posted: Tue Sep 09, 2014 10:50 pm
by braj
I just tried this myself, and if I use the grid when placing the bones and keep them perfectly straight, it seems to work ok. I guess AS doesn't make a preference for either angle that way.

Re: Target Constraint: How how do you change direction of IK

Posted: Mon Apr 20, 2015 12:08 am
by strider2000
This is awesome! It's exactly what I was looking for. Selgin, the video was an excellent tutorial. For other readers that might be interested in this topic I also saw the thread where heyvern solves the issue by using an alternative rig. For the rig I was working with, this approach is the one I prefer, but heyvern's approach can be a cool rig that others might like as well.

Adding a link
viewtopic.php?f=9&t=25729&p=153905&hili ... ne#p153905