View Full Version : Maya: Want to control a rifle with two hands!!??

03 March 2003, 02:34 PM
Want to control a rifle with two hands!!??


I want to control a rifle with two hands, but also be able to control the rifle separately between the two hands!

This is what I have done so far

I created three control shapes.
1. FreeHandCtrl. To control the hand when free from the rifle!
2. GunCtrl: To control the gun
3. LockedOnGunCtrl: so the hand follows the gun when the other hand takes over

I created a locator and point/orient constrained it to all three controls..
This works great for one arm, but the problem starts when I want to orient constrain the rifle to the other arm!!
The rifle flips around to align it self to the other hands local axis!!

Any ideas????

I hope my English didn’t make things even more complicated. -)


03 March 2003, 04:37 PM
maybe this will help you , or answer some questions

03 March 2003, 05:00 PM
Well the problem is that I want to be able to switch between hands to control the weapon!!
not the other way around!!



04 April 2003, 07:08 PM
Well I have a way that you can control your gun with one hand or two hands, or the gun by it self is a little complicated and it takes some time to set but it will work. The only thing is that in this case you need to have IK arm controls other wise it will not work the way you want it to. So here it goes: Make a control for the gun that you can control by it self and namet appropriately. Then create two locators for each arm ik name it appropriately, point and rient constrain the locators to the controlers of the arm ik handels, in other words is what ever you use to control the arm with. Constrain to that or what ever you chose to make as an anchor point, you can use cubes curves or what ever. Then group them to the gun, then create an atribute and name it arm gun or gun off or on,and put it on the gun eather make one for both arms or make two for each individual arm and name it appropriaetly set it to min to 0 max to 10 and clict ok, oh yeah make sure it is a float, then make a set driven key for the atribute and the point and orient constrains 0 at gun control 0 at constarins and key it, 10 at gun control 1 at constrains and key it, what this does it turns the constrains on and of at the anchor points that you have groupet to the gun if you want individual hands to turn off and on then do the set driven key to each arm. The set driven key is the on and off button of the constrains. Hope this works for you.

04 April 2003, 10:47 PM
It's very simple & easy, the trick is you MOVE the gun, the hands will follow (IK)
just link both hand's IK handles to the gun, now move/rotate the gun, when you want one hand off the gun, just use FK switch.
I've tested this with MAX & it workd out, sure in MAYA you can do the same.
MAX has another great feature that is LINK CONSTRAINT (animatable link) that can be used for such a thing. I'm not sure about maya, yet.

04 April 2003, 11:07 PM
you canīt do an on, off attribute for the constraint, cause when itīs off you loose the control over the shape or constraint, you must do the same but as a slide between two constraints, one will be a free constraint for free move the gun, and other at the hand.

this is made a 2 driver locators and 1 driven locator or shape, you made the locator or shape an orient constraint at two points, add an attr with range 0-10 or 0-1, and made a driven key select the contraint ans driven and the locator or shape as driver, with a 0 value made first weigth 1 and second 0, and with the highest value first 0 and second 1, this way you can made a switch between 2 locators,

for the gun

made a join chain with 2 joints, parent the shape to it, made an ik handle for the joint

made 2 locator and name it baseGun and tipGun point constraint the first to the first joint and the tipGun to the ik

group th 2 locators and name gunCtrl

made other 2 locators and name it leftHand and rigthHand and move the leftHand locator to the left hand and parent to one joint of the left hand skeleton and the same with the other locator and the rigth hand

made other two and name it freeLeft and freeRigth made the switch between freeLeft and tipGun, and driven leftHand, and the same with freeRigth and baseGun , driven rigthHand.

with this you can animate de 2 hand free, the gun free, the gun with one hand and other free or with two hands

sorry for my english

CGTalk Moderation
01 January 2006, 07:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.