Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Rigging] Gun-Arm Relationships

Discussion in 'General Discussion' started by awplays49, Jan 10, 2016.

  1. awplays49

    awplays49

    Joined:
    Nov 9, 2014
    Posts:
    36
    Hi,

    I started making a zombie game but I have some questions regarding how rigging arms work for fps games, becuause apparently it is a very controversial topic. Let me start out by saying I have done what I can to research for answers but unfortunately the answers on the web are not helping me, so here are my questions.

    1. How do you rig arms to work for different guns? Like what if you have different size guns does that mean you have to make an animation for every gun category?
    2. Reload animations. I don't get how they work. Let's say a you have a mag that drops out, then you have it teleport to your hand while your hand is hidden, your hand comes into view and you place it in the gun. But then wait, what happens if your pump to cock the gun is on the right hand side, and your gun is parented to your right hand bone, Then what?
    3. How do you make sure that your bones are precisely on the gun, precisely removing the mag precisely pulling the trigger, and precisely cocking the gun back. Like it doesn't make sense, is it just trial and error? There has to be a system you can set up with inverse kinematics, how does call of duty do it?
    4. How much animating should I really do in blender, and what should I leave to animate in unity? Do I rig guns but then animate the guns in unity? What about hands? And don't I need to have the gun in the same scene in blender to see how accurate the hand placement is?
    5. What do you have to animate, and what can you leave to parenting? Can I just parent my gun to a hand? But then it goes back to the other question, Removig your hands from a gun to reload and pump the gun.

    If anyone would be willing to read this and help me out, it'd be greatly appreciated.
     
  2. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Check out the mechanim tutorials.

    You also want to be able to aim the gun as it follows the cross hair/players input.

    So you need to be able to use inverse kinematics to map the hands and arms to the gun.

    You can probably target generic movements to different guns.
     
  3. awplays49

    awplays49

    Joined:
    Nov 9, 2014
    Posts:
    36
    @Arowx Ive been looking, unfortunately there are still a few things that dont make sense to me, and thats why i asked this. For example, the big one is Question #2.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,272
    That doesn't exactly explain what you tried to do.

    Have you ever tried to put together animation controller?

    #2 is very simple. Reloading animation controls both arms at once. So they always move in the unison, and you CAN'T cock your weapon while reloading. It'll be under influence of reloading animation. Call of duty style games have floating arms that move along with camera, so they always move in the same way.

    #1. For fps game every unique weapon type is very likely to get its own unique animation. Keep in mind that there are fps games without arms visible. Quake, Doom, Painkiller.

    #2 You use animation layers for that.

    #3 You adjust movement of "underbarrel" bone with inverse kinematics. Since unity doesn't have builtin mechanism for that, you either write it yourself, or use someone else's work. Alternatively you only ever use animation with guns that fits the animation.

    #4 All of it. Anything you'll try to animate procedurally or adjust at runtime will probably end up looking weird or strange.\

    You won't be able to spin the gun around finger or toss it into air briefly if you do that.

    Have several guns in animation. One being tossed in air, one placed in hand. Move them independently While animation is playing, toggle visibility of different guns via animation events, so only one is visible. You can do that via animation events (those are setup in unity). So when you toss gun in air, you hide gun parented to hand and unhide gun that moves in the air.

    Keep in mind that mecanim animation retargeting does not retarget "extra" bones unless some very specific requiremts are met (names in the entire animation hierarchy below the bone match). Like bones used for props, weapons, unusual appendages, inverse kinematic markers, etc.
     
  5. awplays49

    awplays49

    Joined:
    Nov 9, 2014
    Posts:
    36
    @neginfinity wow thank you, that answers a lot! 2 guns, one visible... Never would have thought of that! Thanks!