Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Simultaneous Animations on First Person Rig

Discussion in 'Animation' started by JD_Designer, May 27, 2017.

  1. JD_Designer

    JD_Designer

    Joined:
    Sep 1, 2015
    Posts:
    111
    Hello,

    Thanks for your time and help in advance! So I'm not exactly sure where to begin tackling this one. I have a first person mesh (rigged). I've imported the rig with two bone animations (hand grip left and hand grip right). I've separated the two animations, making them separate clips via the editor.

    The player should be able to push button A to play the left grip animation or button B to play the right hand grip animation. The player should also be able to push both buttons simultaneously and have both animations play simultaneously. I don't see how to do this via the animation controller state machines given you can only be in one state at a time.

    Do I need to split the mesh and rig in two so I can attach two animation controllers (one controller for the left mesh and one controller for right mesh)? That seems a bit clunky. I'm at a loss. Any help is greatly appreciated! Thank you!
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Combine the animations in 3D and create 1 extra animation with both arms gripping at the same time. Export to Unity, bind to another key - or key combo with both keys down.
     
    JD_Designer likes this.
  3. JD_Designer

    JD_Designer

    Joined:
    Sep 1, 2015
    Posts:
    111
    Thanks for the response. Unfortunately I'm going to need something a bit more precise. For instance, if player hits button A, then waits .25 seconds before hitting button B, the hand animations must follow accordingly.
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Forgive my lack of knowledge with the built in input manager code/scripts. Doesn't the (behavior?) that allows combination inputs (two buttons at the same time) have a time variable. So - if A button is pushed and B button is pushed in 2 seconds or less - treat as button combo - else treat as A button pressed then B button pressed only?

    If yes - this could be set up as you want A for left hand, B for right hand both buttons pressed = new two handed animation.
     
  5. JD_Designer

    JD_Designer

    Joined:
    Sep 1, 2015
    Posts:
    111
    Thanks for the follow up. That doesn't work for me though. What I mean is that if the player bushes button A, waits .25 seconds than pushes B, we should see one hand begin closing and then the other begin to close .25 seconds later. Full disclosure, this a for a VR experience and any discrepancies between what the user is doing in reality versus what is happening within the simulation is immersion breaking. It looks like I'm going to have to split the rig and mesh in two and use two separate animation controllers. Thanks for taking the time though! :)
     
  6. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Ahh! That makes sense why you were considering the split rig in the first place. :)
    Yes - in VR I believe your best bet is to have one controller for each arm/hand, although I've never even considered that set up before - it should give you another layer of control needed.
     
  7. KristianDoyle

    KristianDoyle

    Joined:
    Feb 3, 2009
    Posts:
    63
    You could get by with a combined mesh and 1 Animator controller by using an avatar mask and making use of layers in the animator. Base layer could hold right side, layer 1 could hold left side (masked). You can put whatever you want in separate layers, and play and blend them how you like. You would need layer control code to blend those layers in and out depending on whether your controlling left or right hand. You could also make use of mirroring states and blend trees with this setup. It's all similar to how you would construct a multi-player lower / upper body controller to work with multiple characters.
     
    theANMATOR2b likes this.