Attaching gun to hands?

Hi (again)! :slight_smile:

I have a somewhat basic question I guess, but how can I make a gun stick to the hands of my character?
Is this setup in the 3Dapp (Im using Cheetah3D) or in Unity?

I’m trying to get the arm of the char to hold the weapon and then when I move the weapon the arms should “just follow” if you know what I mean…

But right now I can’t even attach the gun, does someone have any input on how to do this?

// Big bad newbie :wink:

Hi
The fps tutorial ones are positioned in the scene and then parented to the camera…

Drag gun onto camera in hieracy

Does that help?
Cheers
AC

I have never done it in Unity, but basically what you want to do is parent the transform of the gun to the hand bone in your character’s skeleton. Simply positioning them and parenting should work, but it may take a bit of tweaking to get it to look right.

-Jeremy

1 Like

Thanks, my gun is positioned like it should now :slight_smile:

But 2 questions:

  1. How can i make the character hold the gun with both hands? I can only get him to have it as as child to one of them…

  2. How can I make the arms follow the gun and not the other way around (as it is now…)

Thanks in advance :wink:

You can put another gun to the other hand. it will be sooo cool!!! :stuck_out_tongue:

And then make them pistols! :stuck_out_tongue:

To get the other hand on might be tricky actually. You might actually need IK code to do that, which isn’t the easiest thing to do, but it’s not too bad.

Perhaps someone has a better idea than IK?

-Jeremy

Make an animation of the character with the two hands together, using IK in your animation app. Then parent the gun to one of the hands, inside Unity. That would be the usual aproach AFAIK.

That of course would work if he can break it down to a few animations, but I got the impression that he wanted non-canned movement.

Doleman: If you can fake it with animations, I also recommend that you do so.

-Jeremy

Ok, I’ve made a very ugly image on what I’m trying to achieve here
I’m the programmer, not the artist :wink:

The cross on the picture is supposed to be the mousepointer, and the gun is aiming at the cross all the time.
The hands are just supposed to “hang on” to the gun when it changes direction…

Does this help? :stuck_out_tongue:

You might be able to achieve this with physics joints at the shoulder and elbow of the character and then move/rotate the forearm/hand/gun to align with the shooting angle. The result may not be very natural looking.

Naw, second thought, that probably wouldn’t work.

Another idea might be to create an animation that goes from “gun aimed high” to “gun aimed low” and play the animation to a particular frame based on the angle to the target.

Not exactly sure how these would be done, but should be possible…

Yes, this is usually built with IK (inverse kinematic) inside the modelling-animating app. of your choice. Cheetah has good IK. Look for the videotuto of the rigged arm and you will understand it better. With this tool you can use a separate bone as the “driver” for the arms chains, just like in your example.

I would build (in cheetah) an animation with the vertical movement between two extreme poses (looking up and looking down) and then another animation with the horizontal movement.

Then, in Unity, you will need to build a script interpolating those two animations to be used with the horizontal and vertical input axes. And, of course, attach the gun to the same bone used as an IK target in your animations. But I cannot help you in this, as I am only an artist, not a coder :wink:

i have a project with a similar control idea on the back burner atm that was kinda my thought as well. for an FPS view anyway i imagine you can have two arms that are separate jointed objects parented to a master object (for character movement rotation). the gun arm gun does the lookat is clamped to a max angle - the hand on the other is jointed to the gun. never got around to trying it though - but wouldn’t that work?

Idk Bro Sorry i came for the same question

that is what she said. Sorry i had to.

Lolololol, this thread is 8 years old.

Well then, damn

For people like me who just came accross this thread…
This person has a blog article on the subject. Hope this helps.
http://synersteel.com/verus-blog/2013/12/18/unity3d-armor-weapon-attachment-to-character-model

2 Likes