Home Website Youtube GitHub

Space switching (for Ik hands)

Hi,

Forgive me If I’m just being dumb here, but it there an option to set the ik ref of a ik hand control (eg arm_L0_ik_ctl) to follow the other hand?

The example being I have many anims where a weapon is being held in the right hand & I want the left hand to stay attached to the weapon.

I’m unfamiliar with the system currently, so not even sure if it’s possible to constrain controllers if not.

Thanks in advance!

Yes, you can - for example - set “arm_R0_eff” as a space switch in the left arm IK Reference Array. If you do that, when you build, the IK hand will follow the right hand. (This option is found in the arm guide settings. Most components have an IK Reference Array, which is a list of the space switches.)

Note: I’m not actually sure if you should use “arm_R0_wrist” or “arm_R0_eff”. You’ll have to test that yourself and see which controller it follows specifically.

image

But you actually seem to want it to follow a weapon, so don’t do that!

Add the right hand as a space for the weapon. And add the weapon as a space for the left hand. (Or opposite if they are left handed.)

Don’t do both (left to right and right to left) because I’m certain you’ll get a dependency cycle, and it won’t work well.

Thanks so much Chris !

Sorry, I should have explained it properly. So I have a prop bone for the left & right hand (weapon meshes will be attached to these in-game). How would I go about (with the Mgear system) making a controller for these two bones, & then being able to make a space for them in the Ik array? I just assumed I couldn’t do that, & was simply going constrain the weapon mesh to the prop bone ( just so I can visually see it’s position in maya) & to let the prop bone follow it’s parent (the wrist). I would usually then just parent constrain either hands ik effector to the other (depending on if it’s a right or left handed weapon). Not sure on the correct approach with Mgear.

Hope that makes sense, & thanks again :slight_smile:

I’m not clear where you’re getting stuck. Have you tried it yet, or are you just checking if you can do it?

You can add any Shifter guide as an entry in any other Shifter guide’s IK Reference Array. You just have to be careful not to create cycles.

Back to your question, are you saying you have an existing bone, before rigging the mGear guides? And you want to attach those bones to the mGear controllers? If that’s the case, you’d either need to add a constraint, like you said, or dig into the mGear code and implement the way that Shifter does space switches. If you are just using the UI, then you can only really add space switches on the guides, not on your own custom joints.

The “correct approach” (in quotes, because you don’t need to follow the correct approach) would be to create a guide, for example, control_01 for your weapon, and check “Joint” so it makes a joint, and use that joint to skin your weapon. The control_01 can then have space switches added to it.

(But I’m not certain I’m grasping your question correctly.)

Thanks Chris,

I’ll give that a whirl then, & yeah that’s pretty much what I need. I’m using a separate skeleton ( for exporting to unity) that I’m constraining to the Mgear skeleton, but I’ll just make a weapon joint (with the correct approach you mentioned) & then just constrain the exported joint to it.

I see your point about cycles, so not 100% how to avoid that. Guess I’ll just make a weapon control & set spaces up on the left & right hands to follow it, and not attempt to have one hand follow the other.

Apologies if this still doesn’t make any sense. In a nutshell, I’m going to be creating anims with a character holding weapons in both hands at times, and the weapon needs to attach via a bone so the placement is correct when exported.

To avoid cycles, basically I’d go Right FK -> Weapon -> Left IK. I’ve done some schemes where we had floating separate props controls. But that is the most basic non-cycle setup I can think of.

  1. constrain the weapon to either the right hand FK, or the right hand joint. (In my rigs, I include a separate control_01 hand control that is parented under the arm. I don’t know if the Shifter biped template has that or not.)

If you use a separate hand, then the weapon will follow FK or IK.

  1. And I’d constrain the left IK arm to the weapon.

If you don’t have a separate hand control, I’m not exactly sure how you’d specify mGear to use the FK control as a space. There might not be a way without using a POST Python script. But that’s why I just include a separate hand control. Then you have that extra offset control, in FK or IK.

1 Like

Hi Chris,

So I decided the most I’m just going to need is for the player to hold the weapon in either the left or right hand, and the opposite hand follow the weapon or the world.

So just went with the approach of a left & right prop bone (which we currently had in the skeleton any way). I created guides for a L & R prop. For the left prop control, I added a space for the l wrist, world & r_prop.

ik_array

For the right, I added a space for the r wrist, world & l_prop.

None of the created spaces appear for the prop controls. Do I need to make a UI controller for the prop controls, as spaces for the arms live on the UI ctl?

After building I got a cycle error. Assuming it was all the spaces on the new prop controls I removed them all. Turned out to actually be the space I had added on the left arm IK for the right prop control & the space added on the right arm IK for the left prop control:

// Warning: Cycle on ‘arm_R0_ik_cns_parentConstraint1.target[6].targetParentMatrix’ may not evaluate as expected. (Use ‘cycleCheck -e off’ to disable this warning.)

I’m not really sure how this is causing a cycle tho… :thinking:

The prop space I’d added to the left & right Ik arm appear in the ui & function correctly (albeit with the cycle warning).

When I rotate the ik wrist control, the prop control follows with odd behavior, maybe down to the fact it’s moving in an undesired space I can’t change ?

When you mention constraining the weapon to either the right hand FK, or the right hand joint, I’m assuming this is post rig building?

Yes, you need to specify a hostUI control. Otherwise it should default on world_ctl, but I’m not certain.

No, I was speaking generally, but referring to the IK Reference Array.

For the cycle, you said it right in your description. You added the right prop as a space for the left prop. You added the left prop as a space for the right prop.

left prop -> right prop -> left prop. Cycle.

Ok, I’m halfway there I think. I now have a left & right prop control & bone. They have a space to follow their relative Ik controller. The spaces now show on the controls. I also created a space for the left arm to follow the r_prop, & that works fine. So Techically I’m set up to handle a right handed weapon held in both hands.

What I’m not sure on is how I can constrain the weapon to either the rightFK, or right hand joint as you suggest, prior to building the rig.

I attempt to created to create a separate hand controller as an offset, but when parenting it under the arm it does not follow correctly & I’m unsure what spaces I apply to be able to have the flexibility of both left & right-handed weapons that can be grabbed with the opposing hand. Unless I misread and the offset controller technique you mentioned was not for this solution.

I actually went left arm IK>right prop & right arm IK>left prop. But I’m guessing you’re saying that’s still a loop ?

Thanks again for the help so far Chris :slight_smile:

Right-handed weapons work now, with the left hand following. The ideal setup would be this working for left handed weapons as well.

This sounds like a great solution if it avoids cycles & makes this possible. Could you tell me how I’d set this up? ( so right follows left & vice versa)
I can see the function rigbits>CNTRL as child but unsure how I’d do this prior to building the rig so I could set spaces utilizing it in the Ik ref array

Sorry, from here I really can’t follow what you are trying to do or where you’re getting stuck from a text description alone.

I can see the function rigbits>CNTRL as child but unsure how I’d do this prior to building the rig so I could set spaces utilizing it in the Ik ref array

Make a control_01 component in your guide before you build the rig.

This sounds like a great solution if it avoids cycles & makes this possible. Could you tell me how I’d set this up? ( so right follows left & vice versa)

I’m unclear what you thought my “solution” was. Are you still trying to make it so the weapon can follow either hand? From the beginning I’ve suggested you don’t do that. There might be a way. But I suggested a simpler version.

The extra control is just so that it follows the hand bone, and can follow both the IK and the FK arm. If you constrain it to the FK control, when you are in IK mode, it won’t follow. But it will always follow the hand bone.

1 Like

I appreciate the difficulty of getting the point from the description alone.

I misread & thought your solution was to avoid cycles so that both hands could follow each other. I thought the fact I was using a prop bone for each hand, may make this possible.

The prop bone controls I now have setup now are doing the job. If I run into any probs I’ll give your setup a try , thanks for the image, that helps a lot.

1 Like

One idea you could explore if you really need to switch to either direction: Duplicate the weapon. Have a left version (left hand bone -> weapon -> right IK), and a right version (right hand bone -> weapon -> left IK), and switch via visibility.

(I’m working on Unity rigs right now too, and they ask me to hide props by scaling to 0.0. So a visibility switch might be a scale switch.)

Thanks Chris. Yeah, I’m thinking a left & right prop bone should be enough. The weapon can be either left or right handed that way, cant see a point I’d need it to swap within the same anim. Unity wise each weapon has it’s own prefab when loaded & can be set to follow either hand dependent on what’s flagged, so as long as I have a prop for both hands that’s fine.

Having the benefit of the left hand following the weapon was the priority really. Needing left handed weapons (held with both hands) seems very edge case.

Thanks again for all the help / info