Search Unity

FINAL IK - Full Body IK, Aim, Look At, FABRIK, CCD IK... [1.0 RELEASED]

Discussion in 'Assets and Asset Store' started by Partel-Lang, Jan 15, 2014.

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Yes thats how it works. Just like picking up the ball in the Interaction demo/video. If Pick Up On Trigger is true on the InteractionObject, it will be parented to the hand that picks it up.
     
  2. LeftyTwoGuns

    LeftyTwoGuns

    Joined:
    Jan 3, 2013
    Posts:
    260
    Perfect, sounds like exactly what I need. I'm eager to start messing around the the tools but I'm still a little ways from there workflow wise. A good motivator, though
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    0.3 will be submitted tomorrow, sorry for the delay, I didn't plan to add the quadruped grounder at first, but it proved to be easier than I thought, so I decided to add it anyway. Had to make my own wolf though, can't use the Mixamo one obviously :)

    In the meanwhile, take a ride with this angry bot :)

    Best wishes,
    Pärtel
     
  4. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Love it!

    Yay!!

    -Steven
     
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Damn, every time you add features to this I get tons of new ideas for games. So inspirational.

    Excellent work as usual Partel. Thanks! :)
     
  6. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Does this demo is including in the update?
     
  7. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    Woah, quadruped grounding?! This is going to be amazing for my game! I just implemented animals like wandering deer and wolves, and this will make them look so much better than tilting them with the terrain slope. Very excited for the new build!
     
  8. [RV]CWolf

    [RV]CWolf

    Joined:
    Jan 24, 2013
    Posts:
    33
    Very nice =). Looking forward to this! =D
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Yes :)

    It is submitted (no joke), now I hope to get a tutorial done before it's reviewed. :)
    Time to catch up with some documentation too...

    Pärtel
     
  10. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Finally, FINALLY, got this, my day is made. Seems sadly I wont get to play with it for a bit as other tasks clamour for attention but when Final IK's day comes, there shall be a great many IKing all over the place
     
  11. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Hi.
    Could this asset controls some hair bones?
    I hope to apply the IK to hair's child bone and move by responding to gravity.
    Thanks in advance!
     
  12. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Great! Thanks a lot lazygunn, I hope you will be happy with the package. :D

    Technically yes, although I imagine you would have some difficulty keeping the head from entering the skull. I haven't tried this yet.

    Cheers,
    Pärtel
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    This was too easy to make, I couldn't resist ;)


    This demo was made with just a couple of assets from the Asset Store,
    Winter Pack by Manufactura K4,
    Wolf by Mixamo,
    (Free!) music by Tilarids
    and of course Final IK.

    The wolf just follows an array of waypoints and so does the camera and the look at target (Aim IK)

    Cheers,
    Pärtel
     
  14. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97
    Wow! Partel you have done it again!! Now I just need to be able to bake animations.

    Is there an ETA for your animation baking asset? Will it be able to bake Mecanim animations as well as Legacy?
     
  15. KrayonZA

    KrayonZA

    Joined:
    Mar 5, 2013
    Posts:
    52
    Winter is coming...... lol.
     
  16. EarthLaunch

    EarthLaunch

    Joined:
    Mar 7, 2012
    Posts:
    62
    That looks amazing. Makes me think of making a game based on Belgarath the Sorcerer's story. Maybe someday.

    Anyway, this will look awesome on my wolves (and deer) in FE.
     
  17. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Man... That's so Wicked. You've got talent as a procedural animation director.
     
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi Partel, I'm trying to use Adventure Camera Rig from the asset store with Final IK FBBIK, it seems Adventure Camera Rig requires "Animate physics" to be enabled on the animator component, the problem is once FBBIK is active, all the characters animations stop. If i disable FBBIK then the character animates fine again.

    Do you know if there's any work around I can do to get this working please?

    Thanks
     
  19. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Animate Physics causes animation to be handled in the LateUpdate, where FinalIK solvers are handled by default. This results in the solvers being called before the animation is applied, effectively breaking it. From Partel's Unity Feedback post:

    When we need to edit the character's pose each time after animation is complete, it's normally OK to use LateUpdate. But when Animator/Animation.animatePhysics is turned on, it does not work anymore and we have to implement ridiculous hacks for example to simply rotate the head.

    We would need to write something like:

    private void FixedUpdate(){
    lateFixedUpdate = true;
    }

    private void LateUpdate(){
    if(lateFixedUpdate){
    lateFixedUpdate = false;
    // LateFixedUpdate code here
    }
    }

    And that will not even work when there is lag and more FixedUpdates are called than LateUpdates.
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Sure can get this working, no worries. Can you specify, did you just drop on the FBBIK or are you also updating it manually using solver.Update()?

    Its still -2 celsius where I'm at :)


    @everyone many thanks and take a look at the first tutorial about the Grounder:


    This one is about GrounderFBBIK, which uses the FBBIK component for the IK.
    The package also includes GrounderBipedIK, which is very similar, but just uses the BipedIK component,
    GrounderIK, that can use any number of CCD, FABRIK, LimbIK or TrigonometricIK limbs so you can use it for all the spider/bot character types.
    And then there is GrounderQuadruped that is for all the goat simulator clones you are probably working on ;)

    Cheers,
    Pärtel
     
  21. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks for the help.

    This is my script I use to add FBBIK to my UMA character at runtime:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion;
    4. using RootMotion.FinalIK;
    5.  
    6. public class UMAFBBIK : MonoBehaviour {
    7.  
    8.     public GameObject umaCharacter;
    9.  
    10.     public float lookWeight = 0f;
    11.     public float bodyWeight = 1f;
    12.     public float headWeight = 1f;
    13.     public float eyesWeight = 1f;
    14.  
    15.     public bool retarget = false;
    16.     public GameObject target;
    17.  
    18.  
    19.     public BipedReferences references;
    20.  
    21.     private FullBodyBipedIK ik;
    22.  
    23.     private LookAtIK lookIk;
    24.  
    25.     public RhandIKrodHold rodHoldScript;
    26.  
    27.    
    28.     // Update is called once per frame
    29.     void Update () {
    30.     if (umaCharacter != null) {
    31.  
    32.             BipedReferences.AutoDetectReferences(ref references, umaCharacter.transform, BipedReferences.AutoDetectParams.Default);
    33.  
    34.             ik = umaCharacter.AddComponent<FullBodyBipedIK>();
    35.  
    36.             lookIk = umaCharacter.AddComponent<LookAtIK>();
    37.  
    38.             ik.SetReferences(references, null);
    39.  
    40.             lookIk.solver.SetChain(references.spine, references.head, references.eyes, references.root);
    41.  
    42.             lookIk.solver.bodyWeight = bodyWeight;
    43.             lookIk.solver.headWeight = headWeight;
    44.             lookIk.solver.eyesWeight = eyesWeight;
    45.  
    46.             ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA);
    47.  
    48.             rodHoldScript.ik = umaCharacter.GetComponent<FullBodyBipedIK>();
    49.  
    50.             umaCharacter = null;
    51.         }
    52.  
    53.         lookIk.solver.IKPositionWeight = lookWeight;
    54.  
    55.         if (retarget == true){
    56.             lookIk.solver.IKPosition = target.transform.position;
    57. //          retarget = false;
    58.         }
    59.     }
    60.    
    61.  
    62.     public void setUmaCharacter(GameObject character){
    63.  
    64.         umaCharacter = character;
    65.  
    66.     }
    67. }
     
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    There is a bug in the current version of Unity with switching animatePhysics on/off in play mode, it seems to reset the playing animation state, but really does nothing, I mean if you play the scene and turn animatePhysics on, you see that it still updates every frame even if you set Fixed Timestep to 1 (should update animation once per second if animatePhysics was working).

    So maybe its the case that the Adventure Camera and Rig sets animatePhysics true on your character in play mode (which doesn't work), then FBBIK will treat the character as animatePhsyics was working although it really isn't.

    Could you try a couple of things quickly:

    1. Set FBBIK Fix Transforms to false. That will probably unfreeze the animation, but it will be flickering and twitching all over the place

    2. In SolverManager.cs comment out the code in private bool animatePhysics { get {... and make it always return false.

    If that works for this character, we know its the mecanim bug.
    That bug should be fixed in the next Unity update though.

    Cheers,
    Pärtel
     
  23. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks Partel,

    Adventure Camera and Rig doesn't set animatePhysics true on the character in play mode. It works with animatePhysics false but the movement speed is all screwy.

    I'll edit the solver manager and see if that works report back
     
  24. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi Partel,

    Editing the SolveManager.cs with:

    Code (csharp):
    1. private bool animatePhysics {
    2.             get {
    3.                 // Note: changing animatePhysics of Animator in runtime does not work. This is a Mecanim bug, Legacy does not have that issue.
    4. //              if (animator != null) return initialAnimatePhysics; //return animator.animatePhysics;
    5. //              if (animation != null) return animation.animatePhysics;
    6.                 if (animator != null) return false;
    7.                 if (animation != null) return false;
    8.                 return false;
    9.             }
    10.         }
    Made no difference. :(
     
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    @derkoi Its very difficult to guess what might be going on, would it be possible for you to zip me that project and send me a link to support@root-motion.com?
     
  26. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    The project is over 6gb so that's not possible unfortunately. I'll see if I can replicate in a smaller project though. Thanks
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    I noticed from that snippet, there is a comment in it that is not there in the last version so please update to the latest version, it might be that the problem will vanish :)

    Pärtel
     
  28. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi Pärtel,

    Finally i bought the Final IK. It is great!

    And of course, as a noob with it, i have a little problem, and can't find a solution in the forum or the manual. I don't know but is it possible to set the weight in the Aim ik in run-time? I set up all to work with JS and it works and i can make the character move the weapon pointing to the target. it looks very cool, but the problem is that i want the ik solver work only when the mouse is over a "target" and if not the ik stop working. What is the best way to do this. I know there is a solver.Disable, but the transition is very fast. and i want it to enter and exit smoothly.

    Sorry if this is a stupid question, but i don't know what to do!

    Thanks!
     
  29. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    I tried the update it made no difference. However I changed the edit in SolveManager.cs to:

    Code (csharp):
    1.     private bool animatePhysics {
    2.             get {
    3.                 if (animator != null) return true;
    4.                 if (animator != null) return true;
    5.                 return true;
    6.             }
    7.         }
    and it works!!! Awesome! :D

    Thanks for the help.
     
    JGroxz likes this.
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Danirey and welcome aboard! :)

    You can blend the weight by:

    Code (csharp):
    1.  
    2. aimIK.solver.IKPositionWeight = somethingFrom0To1;
    3.  
    But it won't work with characters that have animatePhsyics false anymore. I suggest you leave the code as it was and Disable() the component and update its solver manually for this case. For animatePhysics characters it needs to be updated only in the frames in which FixedUpdate has been called.

    So it would be something like this:
    Code (csharp):
    1.  
    2. void Stat() {
    3.    ik.Disable();
    4. }
    5.  
    6. bool updateFrame;
    7.  
    8. void FixedUpdate() {
    9.  updateFrame = true;
    10. }
    11.  
    12. void LateUpdate() {
    13.     if (!updateFrame) return; // If no FixedUpdate has been called, do nothing
    14.  
    15.     ik.solver.Update();
    16.  
    17.     updateFrame = false;
    18. }
    19.  
     
  31. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks but at the moment, there's only the player character with Final IK on it. So it'll be fine, however I'll keep your solution in mind in case I add more.
     
  32. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Thanks!!!!


    I've used smooth damp to make the transition from 0 to 1 when ik is on and from 1 to 0 when goes off!

    Now it looks pretty nice!

    I'm learning to use all this stuff, and it is fun!

    Thanks Pärtel!
     
    Last edited: Apr 5, 2014
  33. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Good! I'll try! Thanks.

    by the way, I just purchase this asset for few days ago,
    and I'd like to study the asset using a tutorial video on youtube,
    but when the video get fullscreen, blurred...
    I'm glad to get plentiful tutorial video.
    Would you have a high dpi video?
     
  34. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    No update on the Store. What going on with UT?! :(
     
  35. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    This is what I was trying to stress a while back upon it's initial release; I obviously understand it 'can' take time for assets to be reviewed and such, but for some reason Final IK reviews are on the 'longer' end of the spectrum. Many new assets are released within hours or days upon submission, and here we're talking about a mere update to an existing asset...
     
  36. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    I also noted this. Strange....
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey thanks for the purchase! :)

    The videos are all 1080 p full HD, cant get any higher than that on youtube. Make sure to set the quality to 1080 when you go full screen.

    @everyone. I guess the submissions just accumulate sometimes. Its the same with my support requests, for some weird reason, they all usually come at the same time after longer periods of silence.

    Cheers
    Pärtel
     
  38. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Unlucky you. :p
     
  39. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Oh! Solved!
     
  40. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    I have a my pictures case which is Mecanim character's bones structure humanoid.
    In other words, it is some trouble if the neck and shoulders exist the same level Hierarchy...

    I referenced This developer's demo scene(http://www.root-motion.com/demos/shooter.html) and created the following picture...
    very strange...May I ask you to help me?

    $u4.png

    $u5.png $u6.png
     

    Attached Files:

    • $u1.png
      $u1.png
      File size:
      21.9 KB
      Views:
      1,167
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey everyone, 0.3 is up, go grab it! :)

    @arcmohudragon
    Looks weird, are you sure the left hand in the references of FBBIK is the actual left hand of the character, not the left hand target (white transforms in the hierarchy)?

    If that's not it, try to disable Aim IK and FBBIK one by one and tell me which one is causing the mess.

    Cheers,
    Pärtel
     
  42. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Yipikaye :D
     
  43. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Well this is great, as usual!

    *snip*

    Thanks Partel
     
    Last edited: Apr 8, 2014
  44. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Ah, I see I missed some of your posts addressing these very things on page 16, sweet!

    Carry on!! :D

    -Steven
     
  45. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97
    Hey Partel, I like to click the release notes in the Unity Editor Asset Store page to read about updates to assets. Do you think you can submit release notes to the asset store with your future updates?
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Sure, for some reason, I wasn't even aware of this option, so far I've put all my notes to FinalIKChangeLog.pdf that you can find from the RootMotion folder.

    @everyone, let me know how you're doing with the Grounder. I found a small typo in the GrounderQuadruped, in line 224 it should read forelegSolver.rotateSolver = true; (not false).

    Cheers,
    Pärtel
     
  47. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi Partel,

    I'm trying to add the grounder to my UMA character via script at runtime but I'm getting this error:

    I assume I need to initialize the grounder or something?

    Here's my script so far:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion;
    4. using RootMotion.FinalIK;
    5.  
    6. public class UMAFBBIK : MonoBehaviour {
    7.  
    8.     public bool useLookAt = false;
    9.     public bool addGrounder = true;
    10.  
    11.     public GameObject umaCharacter;
    12.  
    13.     public float lookWeight = 0f;
    14.     public float bodyWeight = 1f;
    15.     public float headWeight = 1f;
    16.     public float eyesWeight = 1f;
    17.  
    18.     public bool retarget = false;
    19.     public GameObject target;
    20.  
    21.  
    22.     public BipedReferences references;
    23.  
    24.     private FullBodyBipedIK ik;
    25.  
    26.     private LookAtIK lookIk;
    27.  
    28.     private GrounderFBBIK grounderScript;
    29.  
    30.     public RhandIKrodHold rodHoldScript;
    31.  
    32.    
    33.     // Update is called once per frame
    34.     void Update () {
    35.     if (umaCharacter != null) {
    36.  
    37.             BipedReferences.AutoDetectReferences(ref references, umaCharacter.transform, BipedReferences.AutoDetectParams.Default);
    38.  
    39.             ik = umaCharacter.AddComponent<FullBodyBipedIK>();
    40.  
    41.             ik.SetReferences(references, null);
    42.  
    43.             if(useLookAt == true){
    44.  
    45.             lookIk = umaCharacter.AddComponent<LookAtIK>();
    46.  
    47.             lookIk.solver.SetChain(references.spine, references.head, references.eyes, references.root);
    48.  
    49.             lookIk.solver.bodyWeight = bodyWeight;
    50.             lookIk.solver.headWeight = headWeight;
    51.             lookIk.solver.eyesWeight = eyesWeight;
    52.  
    53.             }
    54.  
    55.             ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA);
    56.  
    57.             rodHoldScript.ik = umaCharacter.GetComponent<FullBodyBipedIK>();
    58.  
    59.             if (addGrounder)
    60.             {
    61.                 grounderScript = umaCharacter.AddComponent<GrounderFBBIK>();
    62.                 grounderScript.ik = ik;
    63.             }
    64.  
    65.             umaCharacter = null;
    66.         }
    67.  
    68.  
    69.  
    70.         if(useLookAt == true){
    71.         lookIk.solver.IKPositionWeight = lookWeight;
    72.  
    73.         if (retarget == true){
    74.             lookIk.solver.IKPosition = target.transform.position;
    75. //          retarget = false;
    76.             }
    77.         }
    78.     }
    79.    
    80.  
    81.     public void setUmaCharacter(GameObject character){
    82.  
    83.         umaCharacter = character;
    84.  
    85.     }
    86. }
    Thanks
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Thanks, Derkoi, thats another typo.

    Please change line 39 of GrounderFBBIK to:
    Code (csharp):
    1.  
    2. public SpineEffector[] spine = new SpineEffector[0];
    3.  
    Otherwise the spine is left a null when you add the component programmatically.

    Pärtel
     
  49. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    I feel like this might be a stupid question, but I've been hasty in the past so why stop now!

    Is there a way to prioritize IK scripts?

    Before going to bed I tossed Grounder onto my character...works wonderfully...but when I tried to add a bit of lean to his body (on angled surfaces), it throws off the Aim IK. Of course I'd want Aim IK to be processed last to ensure accuracy...

    Thanks man!

    -Steven
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    I broke up the User Manual as it was getting far too long to scroll, I also added a page about the Grounder.

    Also the script reference is updated to 0.3