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. Elenesski

    Elenesski

    Joined:
    May 19, 2013
    Posts:
    22
    I have a character which I imported. Is there a way for me to generate ragdoll like elements on it and use the Ragdoll utility, or do I have to set everything by hand?
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi!
    Instead of having multiple hand pose targets and doing linear interpolation between them (that you can't really edit), why not have just one target and use the Animator to animate it. You can create the animation easily in Unity with the Animation Window. Just add the Animator to the hand target, open the Animation window and create animation clips for the poses, then cross-fade between them or use a blend tree.

    Hi!
    Final IK doesn't have a ragdoll creator included, it is not really a ragdoll tool. But you can use Unity's own Ragdoll Wizard for now.

    Cheers,
    Pärtel
     
  3. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,204
    I remember seeing a scene in which there was a 1st person to 3rd person toggle. Where can I find it? Thanks.
     
  4. svarlingo

    svarlingo

    Joined:
    Oct 19, 2015
    Posts:
    2
    Hi!

    I just recently bought Final IK v1.1 from asset store. Awesome stuff!
    I'm running Unity 5.2.1. Most stuff seems to work fine, but not the Grounder demo.

    Whenever trying to plant the feet on the ground they freeze the character in a matrix-looking pose (see screenshot).
    I got the error "Grounding layers are set to nothing. Please add a ground layer.". So i added a new layer called "ground", set the terrain to use that layer and then on the Grounder FBBIK i set the solver layer to that same corresponding layer.

    Shouldn't the demos just work out the box? The Mech Spider doesn't work as well. Its legs are just flying around madly. What could be wrong here? Some mismatch of the versions?
     

    Attached Files:

  5. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    I just upgraded to 1.1, and I was using FBBIK, grounder, and Aim, all updated manually. The first thing I was doing was calling OnDisable () on the components (which under the hood called initiate () on SolverManager). However, in 1.1, this won't happen, and it is a private method so I can't call it externally. What am I supposed to do to initiate disabled solvers that will be updated manually? I made Initiate public and just call that manually for now, which works fine.
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi!

    I broke that demo up to "Third Person Shooter" and "First Person Shooter" demos, the demo script that combined the two modes was too long to grasp and it created some confusion.

    Hi!

    Please try to import Final IK to an empty project. It is probably that your existing layer/collision matrix settings are different.

    Hi!
    You should use just
    Code (CSharp):
    1. ik.enabled = false;
    to disable the component from updating the solver. It will initiate it allright.

    Cheers,
    Pärtel
     
  7. dissentir

    dissentir

    Joined:
    Aug 21, 2013
    Posts:
    1
    Hi, just got this and it's been pretty tremendous so far, can't wait to experiment with a 2D pixel game!

    Question- what would be the best way to rig up a Squid/Octopus? I am using the FABRIK solver for each tentacle and I have the FABRIK root script on the gameobject containing the model. It seems that the root script overrides the IK targets I have set. I would like to move the root and have the targets constrained to their endpoints until they come in contact/collide with another body, and the constraint is set to 0. I guess sticky IK limbs would best describe it, is this possible via scripting? Thanks in advance.
     
  8. IgorRazin

    IgorRazin

    Joined:
    Oct 11, 2014
    Posts:
    14
    Hi!
    How can I exclude some bones from FBBIK processing? I need legs be free.
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey, seems like you have found a bug! :)

    To fix it quickly, go to IKSolver.cs and change
    Code (CSharp):
    1. public void SetIKPosition(Vector3 position) {
    to
    Code (CSharp):
    1. public virtual void SetIKPosition(Vector3 position) {
    .

    Then go to IKSolverFABRIK.cs and add this function:
    Code (CSharp):
    1. public override Vector3 GetIKPosition() {
    2.             if (target != null) return target.position;
    3.             return IKPosition;
    4.         }
    I will add those changes to the next version as well, thanks for the info!

    Hi!
    Can't exclude them from processing but you can exclude them from mapping. Just go to the legs in the FBBIK inspector and set "Mapping Weight" to 0. The legs bones will never be rotated like that.
    If that's what you need.

    Cheers,
    Pärtel
     
  10. IgorRazin

    IgorRazin

    Joined:
    Oct 11, 2014
    Posts:
    14
    Yes, I did this, but I can`t rotate them manually.
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    If you just want to rotate a leg, make sure to do it in LateUpdate. In Update Mecanim has not applied yet and will overwrite your work.
     
  12. equimor

    equimor

    Joined:
    Feb 19, 2014
    Posts:
    8
    Partel Lang, i sent you a private message with a system that i am want to see if i can achieve with final ik, waiting your answer :)
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi, replied in PM...
     
  14. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146
    Hi Partel, I'm starting to learn Final IK and was following the Interaction Trigger tutorial. The only way I get it to work is by adding an interaction to the Interactions array and add the right effector. In you tutorial however you didn't do this step. Is this changed? I'm on Unity 5.2.2p1 and Final IK 1.1

    Also I've noticed that the trigger demo is not working the way you've shown in the tutorial video (errors: Animator.GotoState: State could not be found) My guess is that there are changes in Unity 5.2.2p1 that make this fail?
     
    Last edited: Oct 28, 2015
  15. JimRoot

    JimRoot

    Joined:
    Sep 11, 2013
    Posts:
    77
    Quick Question, how can i switch between different Targets?
    targets.jpg

    in the AimIK one Target field?
     
  16. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi!

    I must have cut adding the effector when editing it, anyway I see it's there in about 7:40.
    I just tested the Interaction Trigger demo scene on Unity 5.2.2, tried all interactions, didn't see any errors. Could you try in a fresh import of Final IK in a new project?

    Hi! You can just assign the new target to aimIK.solver.target;
    That would instantaneously snap to the next target, if you want to smooth into the next target instead, you can just interpolate the target's position between the 3 positions instead.
     
  17. JimRoot

    JimRoot

    Joined:
    Sep 11, 2013
    Posts:
    77
    do you maybe have an example how to cycle threw the targets maybe? Ideal wise always targeting the nearest?
    smooth is not so important. thanks!
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Without any smoothing:

    Code (CSharp):
    1. public Transform[] targets;
    2.    
    3.     public Transform GetClosestTarget(Transform[] targets, Transform character) {
    4.         int closestIndex = -1;
    5.         float closest = Mathf.Infinity;
    6.        
    7.         for (int i = 0; i < targets.Length; i++) {
    8.             float sqrMag = Vector3.SqrMagnitude(targets[i].position - character.position);
    9.            
    10.             if (sqrMag < closest) {
    11.                 closest = sqrMag;
    12.                 closestIndex = i;
    13.             }
    14.         }
    15.  
    16.         return targets[closestIndex];
    17.     }
    18.  
    19.     void Update() {
    20.         aimIK.solver.target = GetClosestTarget(targets, character);
    21.     }
     
  19. JimRoot

    JimRoot

    Joined:
    Sep 11, 2013
    Posts:
    77
    Thanks!
    just as an information if somebody wants to use this script, there is a typo:
    Code (CSharp):
    1. void Update() {
    2.         AimIK.solver.target = GetClosestTarget(targets, character);
    3.     }
    and `character' does not exist in the current context.
    so you have to add

    Code (CSharp):
    1.     public Transform character;
    is that right?
    no, wait, now i get a "error CS0120: An object reference is required to access non-static member `RootMotion.FinalIK.AimIK.solver'"
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Sry, It was just a snippet so you'd get the idea, here's the full code:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. public class AimClosestTarget : MonoBehaviour {
    6.  
    7.     public AimIK aimIK;
    8.     public Transform character;
    9.     public Transform[] targets;
    10.    
    11.     public Transform GetClosestTarget(Transform[] targets, Transform character) {
    12.         int closestIndex = -1;
    13.         float closest = Mathf.Infinity;
    14.        
    15.         for (int i = 0; i < targets.Length; i++) {
    16.             float sqrMag = Vector3.SqrMagnitude(targets[i].position - character.position);
    17.            
    18.             if (sqrMag < closest) {
    19.                 closest = sqrMag;
    20.                 closestIndex = i;
    21.             }
    22.         }
    23.        
    24.         return targets[closestIndex];
    25.     }
    26.    
    27.     void Update() {
    28.         aimIK.solver.target = GetClosestTarget(targets, character);
    29.     }
    30. }
    31.  
     
    hopeful likes this.
  21. JimRoot

    JimRoot

    Joined:
    Sep 11, 2013
    Posts:
    77
    oh, sorry, i just copied it blind without thinking. my bad
    but it works! thank you so much!
    targeting_works.gif
     
  22. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi Partel,
    I would like to ask if you may have a sample or idea on how animate a human figure's arm/hands turning a steering wheel with final ik, do you think this would be possible with final IK? Any advice would help.
    Thanks
     
  23. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Isn't there already a video showing a complete driving setup with wheel, pedals etc
     
  24. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi, thanks for the reply, I've tried searching but cannot find this, do you perhaps have a link for this to share?
     
  25. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146
    I see the Interactions filled in now :)

    Also I've tried to load Final IK into a new Unity project and there the Interaction trigger demo works fine. I think the problems in my other project is because this project is updated from Unity 4.6.8, but I'm not sure.

    Anyway, thanks for helping!
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi!
    It's a really old one, but it's here.
    Also please find the "Driving" demo scene included in the package.

    Cheers,
    Pärtel
     
  27. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146
    Is there a demo for the LookAtIK?
    I'm trying the get it to work and it does for a brief moment but what I want the character to look at a interaction object as long as the interaction is taking place?
    For example:
    As long as my character is pressing the button in, I want it to look at the button.
    Or when I use the pause event on the button I want the character to keep looking until I "unpause".
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Oh, you've found a bug :)

    Please import this patch.
    I'm not entirely happy with the lookat built-in to the Interaction System, it doesn't give you a lot of freedom, I'll give it another try at some point.
    But in the meanwhile if you need more control, you can make your own custom controls for the LookAtIK component and not assign it to the InteractionSystem component. You can use this script and modify it to your specific needs:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion;
    4. using RootMotion.FinalIK;
    5.  
    6. public class InteractionLookAtController : MonoBehaviour {
    7.  
    8.     [Tooltip("Reference to the LookAtIK component (feel free to replace it with AimIK)")]public LookAtIK ik;
    9.     [Tooltip("Reference to the InteractionSystem component")] public InteractionSystem interactionSystem;
    10.     [Tooltip("Interpolation mode to blend in the weight with (to make it smoother)")] public InterpolationMode weightInterpolationMode = InterpolationMode.InOutCubic;
    11.     [Tooltip("Time of blending in/out IK weight")] public float weightBlendTime = 0.5f;
    12.     [Tooltip("The time of smooth-damping the IK target towards the interaction object")] public float targetInterpolationTime = 0.5f;
    13.  
    14.     private Transform lookAtTarget;
    15.     private Vector3 vel;
    16.  
    17.     void Start() {
    18.         // Making sure the InteractionSystem is not controlling the LookAtIK component
    19.         interactionSystem.lookAt.ik = null;
    20.  
    21.         // Register to get calls from the InteractionSystem
    22.         interactionSystem.OnInteractionStart += OnInteractionStart;
    23.         interactionSystem.OnInteractionStop += OnInteractionStop;
    24.  
    25.         // Just in case you need them
    26.         //interactionSystem.OnInteractionPause += OnInteractionPause;
    27.         //interactionSystem.OnInteractionResume += OnInteractionResume;
    28.     }
    29.  
    30.     // Called by the InteractionSystem when an interaction starts
    31.     void OnInteractionStart(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
    32.         lookAtTarget = interactionObject.lookAtTarget;
    33.         StopAllCoroutines();
    34.         StartCoroutine(Blend(1f));
    35.     }
    36.  
    37.     // Called by the InteractionSystem when an interaction stops
    38.     void OnInteractionStop(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
    39.         lookAtTarget = null;
    40.         StopAllCoroutines();
    41.         StartCoroutine(Blend(0f));
    42.     }
    43.  
    44.     // Just in case you need them
    45.     //void OnInteractionPause(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {}
    46.     //void OnInteractionResume(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {}
    47.  
    48.     // Update IK target position
    49.     void LateUpdate() {
    50.         Vector3 targetPosition = lookAtTarget != null? lookAtTarget.position: ik.solver.GetRoot().position + ik.solver.GetRoot().forward * 5f;
    51.  
    52.         ik.solver.IKPosition = Vector3.SmoothDamp(ik.solver.IKPosition, targetPosition, ref vel, targetInterpolationTime);
    53.     }
    54.  
    55.     // Blend IK weight in/out
    56.     private IEnumerator Blend(float weightTarget) {
    57.         float weight = ik.solver.IKPositionWeight;
    58.  
    59.         while (weight != weightTarget) {
    60.             weight = Mathf.MoveTowards(weight, weightTarget, Time.deltaTime * (1f / weightBlendTime));
    61.  
    62.             ik.solver.IKPositionWeight = Interp.Float(weight, weightInterpolationMode);
    63.             yield return null;
    64.         }
    65.     }
    66. }
    67.  
     
  29. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Oh right, I'm using Unity 4.6, I just noticed I cannot download Final IK to that version! Has the Unity version suppored change since the early days? How can I get the latest final IK onto Unity 4.6?
     
  30. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Nevermind got it all working now , in 4.6 :) Thanks Partel for pointing me to the driving tutorial, just what I was looking for!
     
    Partel-Lang likes this.
  31. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146
    Thanks, I will give it a try :)
     
  32. bfoddy

    bfoddy

    Joined:
    Mar 27, 2012
    Posts:
    85
    Hi! This is a really great package, very impressed.

    I was wondering if there's any way to alter the built-in rotation limits in the FBBIK solver? I have a model whose arm is disappearing inside his chest, even if I put elbow effectors outside his body. Do I need to put colliders on the skeleton? cr.jpg
     
  33. HiThatGirl

    HiThatGirl

    Joined:
    Nov 12, 2014
    Posts:
    19

    I need some example of this video, can anybody help me ?
     
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi! Are you sure you have the references right in the FBBIK component? Looks like clavicle bones are used instead of the upper arm bones?

    A toolset for that kind of stuff will be released any day now, watch this space. :)

    Pärtel
     
  35. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    If anyone's still wondering:

    upload_2015-11-7_22-56-37.png

    Yet more proof of this being a flagship asset for Unity. The author not only removes compile times while providing source, he also makes it a click away to get the precise help you need. This level of detail would be wonderful for Unity itself.

    Essentially Partel does a better job than Unity does. Pay attention Unity.
     
    hopeful likes this.
  36. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    @Partel: happy with the tool so far!

    I've noticed that the different angle limits does not support multi-object editing. Adding [CanEditMultipleObjects] to eg. RotationLimitAngleInspector works out of the box, so I'd suggest doing that. It makes working with big chains a lot easier.
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey, thanks a lot man, I just wanna close this thread now with this as the last post. I appreciate it :)

    Hey, thanks for the feedback, I'll put it down to my todo list for the next version :)

    Cheers,
    Pärtel
     
  38. Elenesski

    Elenesski

    Joined:
    May 19, 2013
    Posts:
    22
    I hear in the Puppet Thread that Final IK 1.2 is being released along side. What's in the release?
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    See the release notes, it was just accepted to the Store.
    It's a minor release with some fixes/improvements, I released it now to ensure everything works well with PuppetMaster.

    Cheers,
    Pärtel
     
  40. Ulven2

    Ulven2

    Joined:
    Apr 23, 2012
    Posts:
    64
    I'm trying to use Full Body Biped IK with a custom animation system that sets the rotations in Update() and also in OnMouseDrag() for some controllers, but it looks like the IK system doesn't consider anything about what rotations are in place already from these scripts (unlike what it does for mecanim/legacy animation). Even if I set the weight of the limbs to 0 on position and rotation, set the weight of the whole plugin to 0 or even set the iterations to 0, it still pushes the limbs back to the rest position instead of letting through the animation underneath. Is there some way I can set the underlying animation in a similar way to what happens when using this on top of mecanim/legacy via script?
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Use "LateUpdate" instead of "Update". Mecanim will overwrite all your rotations between Update and LateUpdate.
     
  42. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,204
    I'm interested in getting started with Android VR development. Does your VR examples work with any HMD, such as Google Cardboard, or are they specific to Oculus only?
     
  43. Ulven2

    Ulven2

    Joined:
    Apr 23, 2012
    Posts:
    64
    I'm not using Mecanim, the problem is that FinalIK is also overwriting/ignoring all rotations from Update, or not considering them before it's calculation. Also OnMouseDrag runs before LateUpdate and therefore is overwritten by FinalIK.
     
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi! It is not Oculus only. The VR demos I have tested on Oculus only, but the relevant IK part in it is just parenting the head effector to the camera and that's it. So since you can parent the IK target gameobjects to whatever you need, I can't see any problems.

    I see. If you uncheck "Fix Transforms", it will not force the character to the default pose in each Update. You can also just disable the IK component and update it's solver whenever you need by ik.solver.Update();

    Just keep in mind that if you are not playing animation and not using Fix Transforms you should have something that overwrites the rotations of the bones each frame, otherwise IK will solve additively on top of itself.

    Cheers,
    Pärtel
     
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    montyfi likes this.
  46. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Congrats, will pick up the PuppetMaster very soon!
     
    Partel-Lang likes this.
  47. halobungie

    halobungie

    Joined:
    Apr 23, 2013
    Posts:
    5
    Hello Partel Lang,
    why did you not come to Unreal Engine 4 (UE4) and bring your wonderful tool to UE4?
    There is nothing good like your Tool...
    I hope the Best!
    Kind regards,
    halobungie
     
    Partel-Lang likes this.
  48. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    If this can automagically create the limb colliders needed for dynamic clothes then it's worth the upgrade price.

    Making people fall down is just icing on the cupcake. :D
     
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    I'm "born and raised" in Unity, I once opened UE4 but it didn't feel right ;)

    Yes it can, but it will also create Rigidbodies and Joints which you will have to delete manually if you only need the colliders.

    Cheers,
    Pärtel
     
    XthemeCore, hopeful and wetcircuit like this.
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey all,

    Just letting you know that I will have to remove the discount of PuppetMaster for Final IK users.
    Because of the upgrade, the reviews and ratings are shared between the 2 packages, which is wrong and confusing for the customers. So if you think you'll need PM, get it before the next week.
    A proper discount system is in the Asset Store roadmap though. :)

    Best Regards,
    Pärtel