Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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

    justdizzy

    Joined:
    Mar 8, 2016
    Posts:
    90
    I am using VRIK (animated locomotion, fix transforms is ON) in a multiplayer arena style game where the local device is processing the IK for the remote avatars so I just network the head and hands transform data.
    To increase performance, I'm setting the LOD of VRIK to 2 (culled) if the avatar's renderer (LOD) is also culled. This had an unfortunate bug in that when VRIK was culled while the avatar was locomotion, "Apply root motion" on the animator would cause the avatar base to continue to move away from it's networked parent, and suddenly we'd have no avatar when that networked parent came back in to view.
    My solution was to manually reset "VRIK_IsMoving" when culled, and reset the avatar base to local zero, but the problem still occasionally exists.
    My 2 questions are:
    1. given the above scenario, is there something else I should do that I might have missed in using VRIK LOD?
    2. What are the consequences of just turning off "Apply root motion" to the animator? I briefly tried it and saw that the walking animations no longer matched the characters space traversal, but that might be fixable with adjusting animation timing. Any other issues as far as VRIK is concerned?
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    VRIK will automatically adapt to changing bone scales, no need to restart it.

    Hey,
    Yes, please see this and that video.

    Hey,

    Does it work if you disable apply root motion only while VRIK LOD is set to 2?

    Best,
    Pärtel
     
    Spikebor likes this.
  3. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    308
    Hello
    I notice there is a IK Jobs (Unity 2019.3) integration however I cannot find any info about it.
    Would you be able to provide some info about this integration.

    Regards
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    It has the AimIKJ and CCDIKJ components, which are just AimIK and CCDIK written as AnimationJobs. It was my attempt at making multithreaded IK, which I dropped because there was no performance gain even with a 100 characters. Kept the package around for all the people asking me about multithreaded IK.

    Best,
    Pärtel
     
    Hazneliel likes this.
  5. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Is there a way to make it adjust to offset bone locations instead of needing to scale them?

    If I scale a bone, it will scale all child bones as well, unless I do additional math. While, if I adjust the offset for the child bone, I don't need to do any further math. Also, most skeletons are inconsistent regarding which axis is forward, so I can't rely on just scaling on one axis because that might not work on another model.

    -Chilton
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Can just multiply the localPositions of the bones.
    Store the default localPositions at Start and do something like bones.localPosition = defaultLocalPositions * multiplier;
    It won't depend on forward axis, mess up scaling and VRIK will automatically adapt to that too.

    Best,
    Pärtel
     
  7. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Hi Pärtel,

    Do the joint limits work with VRIK?

    Can I add a thing to an elbow, for example, to ONLY let it bend in one set of directions, and ONLY for a limited range of motion?

    Thank you!
    -Chilton
     
  8. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Please tell me how to rig to animate chest rotation (I want more control over pose)
    FBBIK's body only do move.
    I rather not use LookAtIK because it has its own use.

    These imgs describe my problem better, I tried to use CCDIK but this is all I can do:
    upload_2023-5-21_23-46-53.png upload_2023-5-21_23-48-5.png

    But cannot rotate like this.
    Preferably, I want to use a transform to rotate the chest.
    upload_2023-5-21_23-49-1.png
     
  9. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Same problem, add a Chest rotator and Hips rotator would be dope.
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    No, sorry, VRIK arm solver has its own internal constraints. But the elbow works as a hinge joint nevertheless. The direction of bending is defined in Start when VRIK samples the pose so make sure the arm is bent slightly in its natural bending direction in Editor.

    Hey,
    Please take a look at the "Offset Effector" demo scene about that (not to confuse with "Effector Offset" demo).

    Best,
    Pärtel
     
    Spikebor likes this.
  11. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Oh the direction isn't the issue, it's the degree of rotation. How much it can bend.

    Would I be better off using a different IK solver in the FinalIK family? Are there reasons to use VRIK other than simplicity of initial setup? If you have a solution, let me know!

    -Chilton
     
  12. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Oh damn it works perfectly.
    Thank you for making this awesome asset, I'm very satisfied with this purchase.
     
    Partel-Lang likes this.
  13. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    289
    Hi~, don't know if this helps but I got consistent crash if I edit spine curve, both Edit mode or Play mode.
    Unity 2022.2.17f1
    upload_2023-5-26_23-57-51.png
     
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    Using limits on top of IK usually gets you worse results than not having limits. You'll get IK snapping violently from one pose to another and stuff like that. You can make RotationLimits work on top of VRIK though, with an added component like this. Using limits post-IK will make the end position of the hand inaccurate when a limit is exceeded though. You can also enforce Humanoid muscle limits in a similar way with this script.

    Hey,
    Looks like a Unity bug, can you try another Unity version?

    Best,
    Pärtel
     
  15. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
  16. amitghimire

    amitghimire

    Joined:
    Jun 15, 2022
    Posts:
    12
    Hi, How do I suspend the control of my avatar for a bit (lets say when I press a button), reset all the bones to a default position and then gain control back again? I want to do this because I am using CCDIK with rotation limit to simulate a robot teleoperation and sometimes the robot takes some weird configuration so when this happens, I want to reset the bones to a default state before controlling them with IK again. Thank you in advance!!
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    What exactly is going on in that video? Are the foot IK targets raised that high or and the problem is the inverted bending direction of the knees? If so, then the problem is that the IK components sample the pose as Start to find out which way to bend the limbs. That means the legs must be bent slightly in their natural bending direction at that time.

    Hey,
    Can call ik.solver.FixTransforms() to reset to default (initial) pose at any time.

    Best,
    Pärtel
     
  18. airop

    airop

    Joined:
    Sep 4, 2012
    Posts:
    34
    Hey I am trying to set up a character with final ik on a bike, but i want him to let go of the sterring wheel and play a melee animation and grab the steering wheel again, but it just looks horrible, how can i make sure that the animation plays correctly and the pose kinda stays in place ( i am using playmaker, but if playmaker is not an option a code solution is fine )
     
  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    Can you please share a video of what the melee animation looks like without any IK?
    Is there just FullBodyBipedIK or some other IK in play aswell?

    Best,
    Pärtel
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
  21. airop

    airop

    Joined:
    Sep 4, 2012
    Posts:
    34
    Just Fullbodybipedik and the interaction system to grab the bikes steering wheel and letting it go once the animation starts. here is a video of the animation off the bike and on the bike. in this case i have not connected the arm.




    upload_2023-6-6_12-59-54.png

    upload_2023-6-6_13-0-19.png
     

    Attached Files:

  22. airop

    airop

    Joined:
    Sep 4, 2012
    Posts:
    34
  23. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Maybe you can make the curve in the InteractionObject go down to 0 faster after you let go of the steering so the IK would stop interfering with the animation? Not sure what else to suggest with the information I have. If you could send me some kind of a repro, I'd take a closer look.

    Best,
    Pärtel
     
  24. ChescoRed

    ChescoRed

    Joined:
    Sep 29, 2018
    Posts:
    36
    Hello everyone, for VR on versions 2021.3.27f and 2022.3.1f1 does not track controls with Oculus Integration, has anyone experienced the same problem?

    If it detects the pulsations of the controls, and even creating a new player without VRIK, or another scene, the tracking no longer works.
     
  25. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Do you mean in general or in the context of FinalIK?

    -Chilton
     
  26. ChescoRed

    ChescoRed

    Joined:
    Sep 29, 2018
    Posts:
    36
    Final Ik, Until I implement Final Ik the tracking works perfectly.
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    I can't think of any way FIK could interfere with controller tracking. All it does is move and rotate some bones really.
     
  28. Greta_Alv

    Greta_Alv

    Joined:
    Jun 24, 2019
    Posts:
    2
    I am trying to get FinalIK working with photon networking, so I was looking at the packaged example for SteamVR, but the scripts are missing on the PUN_Player camera rig prefab. The oculus prefab does not have this problem. Anyone have any idea what is supposed to go in there? I've tried re-importing with no luck. MissingScript_FinalIK.PNG
     
  29. Greta_Alv

    Greta_Alv

    Joined:
    Jun 24, 2019
    Posts:
    2
    Nevermind... it's because I didn't have the SteamVR plugin fully installed.
     
    Partel-Lang likes this.
  30. Sethoscope

    Sethoscope

    Joined:
    Dec 28, 2017
    Posts:
    1
    Hi Partel and everyone. I'm trying to use Final-IK in a project, with a model I made in Blender and rigged with Rigify. It looks like it can't automatically set the references, and I'm not sure how to set it up manually. I'm pretty new to Blender/Unity -- so apologies if this is really basic. I tried mapping it to the bones that sounded right, but I'm not even sure if I should be using the deform bones, the IK bones, etc. Any help/pointers would be appreciated.
     

    Attached Files:

  31. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Hi Partel,

    If I know the height off the ground that the pelvis needs to be, in VRIK, how can I correctly set the legLengthMlp?

    Asked another way, what's the magic number to multiply by the actual height, to get the MLP if I know the height to the pelvis?

    Thank you!
    -Chilton
     
  32. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    Hello Pärtel,

    is there built in way to get just the solved IK joint rotations? Eg. Method to get the correct IK arm pose just for that one frame (without setting the boneTransform.localRotations immediately)

    Something like: Quaternion[] solvedBoneRotations = Arm.Solve(targetTransform);

    I'm trying to do custom lerping from one arm pose to another arm pose that is modified with IK

    If there is no built in way, how should one accomplish this the best way?

    Thank you!
     
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    Not sure which bones are which without seeing the actual fbx. But if you set rig to Humanoid in the model import settings, then Final IK can automatically fill out the References.

    Hey,
    float avatarPelvisHeight = avatarPelvis.position.y - avatarRoot.position.y;
    float legLengthMultiplier = realPelvisHeight / avatarPelvisHeight;

    Hey,
    Not without digging deep into solver code. But you could store arm rotations in LateUpdate before the IK solves, then let it write to the bones and do the lerping between the 2 after that.

    Best,
    Pärtel
     
  34. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
    Hi, on the FullBodyBipedIK component, how I could change the Position Weight the right hand at runtime via script.
     
  35. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
    I think I just figured it out
    Code (CSharp):
    1. FullBodyBipedIK _fullBodyBipedIK = GetComponent<FullBodyBipedIK>();
    2. _fullBodyBipedIK.solver.rightHandEffector.positionWeight = 1f;
    3.  
    4.  
     
    Partel-Lang likes this.
  36. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    118
    Hey Pärtel, sent you a PM! Thank you.
     
  37. DavidM27300

    DavidM27300

    Joined:
    Sep 20, 2022
    Posts:
    6
    Hi, I'm using VRIK for an augmented reality app. This app does not have hany controller it use hand tracking but as soon as the hand are not in the field of view of the headset cameras the arm are following the head. It means that when I'm looking down my arm are going backwards (in a very akward way...) when I'm looking up the arms are going forward...
    Is there any way to lock the arm straight when my hands are not tracked ?
    Thank you :)
     
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    What makes them follow the head? I think maybe the hand targets are parented to the head target? Can you just unparent them?

    Best,
    Pärtel
     
  39. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    568
    Hi Pärtel,

    This is a super weird glitch. What you see in this video is two identical skeletons, with identical settings for VRIK. This is an unlisted video.

    https://youtube.com/shorts/QrXJ4i2Thf0?feature=share

    I've been trying to "fix" these weird issues in the skeleton for months, and I just now thought to make a new skeleton using the same base model. So these are identical skeletons and identical VRIK settings. And the exact same three points, just head and hands. The only difference is that the weird skeleton is the one that I've been trying to "fix" in vain for months.

    I've verified that every point and every joint is identical. The skeletons are identical. The VRIK settings are identical. As far as I can tell, everything I can see from in the editor is identical between the skeletons and settings.

    So is it caching something? Maybe a metadata issue? I have no idea. So what the heck could cause this?

    Thank you,
    -Chilton
     
  40. ThisIsJeff

    ThisIsJeff

    Joined:
    Oct 30, 2019
    Posts:
    6
    Hi Partel!

    Is there any way to make your VRIK component solve the hand ik for two different targets?
    Say, for example, I solve the left hand for the VRHand target, then set its bone position to be the VRIKBonePosition, then solve the left hand again to ik to another target, say, and object target, right after, all in the same loop. Is that possible?

    Essentially I think I am looking for a way to externally call the solving for that arm after specifying the target?

    For context, I am trying to determine the reach a player's arm can have, and with that set the grabbable object to that position, then move the hand to the attach point of the object that is being currently held. Maybe there is a way to determine where the hand would be if "this" is its target?

    Hope my question makes sense haha
    Thanks for your help!
     
    Last edited: Jul 26, 2023
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    Ummm, can you send me what you have in that video as a repro project/package please? Difficult to say without getting hands dirty.

    Hey,
    When you solve VRIK, it will reach the hand as far as it can go. So if I understood you right, then all you need to do is to wait for VRIK to finish solving, then move the object to the player's hand.That way it will always stay in reach and not fly out of hand.
    If you need to know reaching distance before solving VRIK, then it's roughtly upper arm bone length + forearm bone length. Shoulder rotation gives a little extra reach, but no way of knowing that before the solver is done.
    Can also solve a pass of LimbIK on the arm after VRIK is done if you need to. Then you need to disable the IK components in Start and call ik.solver.Update() on both of them in the order you need from LateUpdate.

    Best,
    Pärtel
     
  42. ThisIsJeff

    ThisIsJeff

    Joined:
    Oct 30, 2019
    Posts:
    6

    Hey Partel!

    Thanks for your response! Yes, I needed the rough max distance before the VRIK ran, but I managed to find a solution with the estimation you mentioned, so upperarm and forearm length. This gave me a good enough estimate for me to then do the things I needed.

    Just as an additional question, is there any way for us to make the hand move towards the iktargetposition with physics? I understand that its moving by transform now, but maybe it could do the same but with forces?

    Thanks! The tool is being amazing for us so far!
     
    Last edited: Jul 30, 2023
  43. DavidM27300

    DavidM27300

    Joined:
    Sep 20, 2022
    Posts:
    6
    I'm quite new to Unity, what do you mean by parented ? You mean the rig or there is a settings somewhere for that ?
     
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    If you need to move the hand with forces, you'll need it to be an active ragdoll, PuppetMaster asset can help with that.

    Hey,

    upload_2023-8-7_11-13-48.png
     
  45. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    191
    i got this LogWarning
    "FBIK chain length is 0. Can't initiate solver"

    This happens irregularly.
    Without changing any environment and settings,
    Just by running and canceling play mode over and over again,
    Sometimes it happens, sometimes it doesn't.

    I'm not setting FBBIK at runtime.
    I've added this on Prefab.
    Even if i check the FBBIK component of the prefab on Scene, it seems that all of the references and Roots are set up well.


    Which part should I check?
     
  46. TAPE_EATER

    TAPE_EATER

    Joined:
    Nov 2, 2019
    Posts:
    15
    Hi,
    I've been trying to implement the setup used in the "Combining IK Solvers" tutorial.
    Using a Aim IK and adding a couple of constraints on top.

    The problem I have is that my character does not have a l/r underarm bone so I cannot use the FullBodyBipedIK, I've been trying to figure out if I can replace the FullBodyBiped with LimbIK (Which also gets mentioned in the manual's "Aiming 2-handed weapons" section) but I haven't figured it out.

    I'm basically just trying to set the left hand on my gun based on the right hand position just like the tutorial, but I don't understand exactly how to get the bones in script when using LimbIK instead of FullBodyBiped.

    So my question is how to approach these lines when using LimbIK:
    private IKEffector leftHand { get { return ik.solver.leftHandEffector; }}
    private IKEffector rightHand { get { return ik.solver.rightHandEffector; }}
     
  47. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey, can you clock on that error in the console make a screenshot of the whole callstack pls? My guess is it's a race condition and some script wants something from FBBIK before it has initialized.

    Hey,
    LimbIK doesn't have IKEffectors so it's a bit different. But for example:

    fbbik.solver.leftHandEffector.position is the same a limbIK.solver.IKPosition;
    fbbik.solver.leftHandEffector.positionWeight is the same as limbIK.solver.IKPositionWeight;

    Best,
    Pärtel
     
  48. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    191
    Thanks, In console
    upload_2023-8-15_9-18-9.png
     
  49. TAPE_EATER

    TAPE_EATER

    Joined:
    Nov 2, 2019
    Posts:
    15
    Great, thanks!
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,568
    Hey,
    Thanks, that's weird, haven't seen it happen before over the years. I think something might be corrupt with the IK component/solver, can you try deleting it and adding a new one please?

    Best,
    Pärtel