Home Website Youtube GitHub

Hind Legs for quadraped don't align with guides created?

Hey Guys! I am trying to rig a Horse using the default template…I can make the guides just fine but when creating the rig, the joints for the back leg are placed always placed in the same bizzare postion despite me changing orientation of the guides…any idea how I can do this correctly?

1 Like

Hi, there are known issues with the springSolver IK in Maya.

From your screenshot, this looks like something different. But it might be the same problem.

It does look like more than just flipping though. Do you have any non-uniform scaling on your guide?

Also of interest, Morgan Loomis used to have a good tutorial about rigging hind legs using the springSolver. He no longer uses it. He posted his technique here: https://twitter.com/morganloomis_/status/1307263399210840065

I am doing some tests with how to script this, no matter what the angle of the legs are, so we can potentially include this in a Shifter component. Then we can maybe get rid of the springSolver once and for all. (I have it working on parallel limbs, but not non-parallel limbs yet.)

1 Like

just to make sure - when you switch to FK the joints are placed correctly?
this issue might happen sometimes if your guides aren’t on the same plane, as IK needs to be on the same plane to work correctly and if it’s not then unexpected things (like perhaps this) can happen.

1 Like

I have it working on parallel limbs, but not non-parallel limbs yet.

Do you mean planar vs non-planar? The current leg_3jnt component restricts the guide placement to be planar.

No, I meant parallel.

If bone 1 and bone 3 are parallel in the guide, the math to solve where to put the counter-joints - as in Morgan’s technique - is very easy. The lengths are simply inverse. If they are not parallel, I need to solve a better formula.

(Planar is important too.)

Maybe this helps! It expects joint chains [jnt0… jnt3] and [helperJnt0…2] like in the diagram.

import pymel.core as pm
from mgear.core.transform import getChainTransform2

# Pick joint chains
jnts = [pm.PyNode("jnt" + str(i)) for i in range(4)]
helperJnts = [pm.PyNode("helperJnt" + str(i)) for i in range(3)]

# Read world space xforms and positions
jnt_xform = [j.getMatrix(ws=1) for j in jnts]
Jn = [j.translate for j in jnt_xform]
L = sum([(Jn[i + 1] - Jn[i]).length() for i in range(3)])

# Compute ja and Jfull
ja = (Jn[1] - Jn[0])
ja.normalize()
Jfull = Jn[3] - Jn[0]

# Main formula
A = (Jfull * Jfull - L * L) / (2 * (ja * Jfull - L))

# Construct helper joint chain
hj1_pos = [Jn[0], Jn[0] + ja * A, Jn[3]]
hj1_norm = pm.dt.cross(Jn[1] - Jn[0], Jn[2] - Jn[1])
hj_xform = getChainTransform2(hj1_pos, hj1_norm)

helperJnts[0].setMatrix(hj_xform[0], ws=1)
helperJnts[1].setMatrix(hj_xform[1], ws=1)
helperJnts[2].setMatrix(hj_xform[2], ws=1)

6 Likes

@Aerys Boom! :smiley:

Thanks, that works great. That seems to work perfectly in every combination of non-parallel configuration I can throw at it. This could be an excellent basis to creating a new quadruped component.

If no one beats me to making it, I’ll start working on it.

quadrupedize

7 Likes

Yeah FK works just fine…I tried changing the rotation plane solver but that didn’t work…

Glad to help! I’m pretty sick of random spring solver flipping during build…

4 Likes

This is great!

The 3jntleg has been frustrating to use (for all the reasons described on this forum) I ended up having to make a janky script to get something to not flip on my rigs, which took alot of functionality away.

Looking forward to this elegant implementation!

2 Likes

@kronos1711 At this point if you still want help, can you share your guide, so people can look at it and see what might be going wrong? This seems like more than just the flipping problem.

2 Likes

I love these conversations! Thank you guys! for all the input!

I have added the link to this issue https://github.com/mgear-dev/shifter_classic_components/issues/11#issuecomment-703333773

@Aerys I will check your code and try to implement it on the component. Thanks!

4 Likes

Hey! Yes…here’s the rig(should’ve done that in the first place, my bad)…FK works just fine…and the leg3 rotation plane solver doesn’t do much…sorry for not replying earlier. Horse Rig guides file

1 Like

Hi @kronos1711

I believe the problem is that in your leg, you specify “backLegUI_L0_root” as the Channel UI Host. But that object no longer exists. And so the stretch or some other parameters are collapsing to nothing, and your leg ends up in a weird pose by default.

If you use an existing control as the UI Host, it seems to work again.

(Otherwise, if that UI Host exists in your real rig, and the guide you sent me was stripped down, it would be better if you sent the actual guide that is experiencing the problem.)

3 Likes

Hey Chris! Thanks for the help!:smiley: …could you pls tell me how can I specify the ChannelUI host? Sorry I am new to the world of rigging :frowning:

  1. Select your leg.
  2. Open the guide settings.
  3. Select a control that you want the leg attributes to be hosted on, and click the two arrows under “Channels Host Settings”
3 Likes

Amazing! It worked…thank you so much!

1 Like

Hey just read this thread and wanted to bump this a bit. Any chances of folks wanting to maybe come up with a custom spring solver based on the 2IK Set up? I’m wondering how difficult of a task that would be. Lot of really good solutions in here I saw posted.