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:
    1,908
    So to transition, blend the leg and pelvis weights to 0 and if you are using a sitting animation, crossfade to idle or play a stand up animation too.
     
  2. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    34
    I did, like this :

    characterVRIK.solver.spine.pelvisPositionWeight = 01.0f;
    characterVRIK.solver.spine.pelvisRotationWeight = 01.0f;

    characterVRIK.solver.leftLeg.bendGoalWeight = 01.0f;
    characterVRIK.solver.leftLeg.positionWeight = 01.0f;

    characterVRIK.solver.rightLeg.bendGoalWeight = 01.0f;
    characterVRIK.solver.rightLeg.positionWeight = 01.0f;
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    And what did the results look like, could you make a video or something please?
    If the hips are floating, can't you move it down to the seat by moving the pelvis target?
     
  4. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    34
    Hey, I disabled the foot and knee position changes and it's working. Somehow changing the knee and the pelvis were not working together. Just the pelvis target also does the job.

    Thank you.
     
  5. aqleaq

    aqleaq

    Joined:
    May 17, 2017
    Posts:
    2
    I use Full Body Biped IK in my game, but the angle of the knee is recognized in the wrong state like the first picture attached.
    What is the probable cause?

    In this state, using the foot IK will be the state of the second attached image.
    It can be solved by the bend parameter, but the unreasonable part comes out to the mesh.
     

    Attached Files:

  6. himirin00

    himirin00

    Joined:
    Jul 22, 2015
    Posts:
    1
    Hey guys, I am using CCDIK for my generic rig character.
    I found that the position field of the child bones in the inspector didn't changed, only the rotation field updated. How can I get the current bone's local position during update?
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    Here's how it can be fixed.

    Hey,
    Not sure if I understood. CCDIK doesn't move the bones, it only rotates them so that's why local position doesn't change.
    Maybe you tried to get what you needed to get before CCDIK updated for the frame. Please try using ik.solver.OnPostUpdate delegate:
    Code (CSharp):
    1. public CCDIK ik;
    2.  
    3. void Start() {
    4. ik.solver.OnPostUpdate += AfterCCD;
    5. }
    6.  
    7. void AfterCCD() {
    8. // Read bone positions/rotations here
    9. }
    or add your script to a higher value than CCDIK has in the Script Execution Order and use LateUpdate to make sure the code runs after CCDIK.

    Best,
    Pärtel
     
  8. aqleaq

    aqleaq

    Joined:
    May 17, 2017
    Posts:
    2
    It has been fixed!
    Thank you.
     
  9. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    28
  10. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    35
    I have a rigged and skinned robotic model with only 2 arms and 3 fingers in each hand, all linked to a sphere acting as a body. Would this asset work with this model?
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    Thanks for the info, I'll fix it...

    Hey,
    What did you intend to do with that robot, use as VR avatar?
    FIK is very modular so yes, you should be able to use it. Could just attach 2 ArmIK or LimbIK components to solve the arms.

    Best,
    Pärtel
     
  12. KardoseR

    KardoseR

    Joined:
    Feb 21, 2014
    Posts:
    7
    Hi I am not sure where to post this so I will give this a try.

    I need to create a crowd simulator where people would bump into eachother and have the possibility of falling to the ground depending on the impact force and balance of that person.

    Obviously all the bumps and falls should look real as the characters try to balance themselves.

    Should i use final IK or puppet master? My guess is i need both but im not sure?
     
    Last edited: Jul 9, 2019
  13. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    72
    Is there a way you can think of that would allow the puppet/ragdoll to move the playspace in VR. I feel like this should be easy but I have tried a bunch of different things with no success. Been trying to achieve a physics-based climb system similar to bone works and just haven't had much luck. I can get something decent working without final ik or puppet master but I'd like to leverage ragdolls and muscle strength to move the player around.
     
  14. Michael_R

    Michael_R

    Joined:
    Sep 6, 2018
    Posts:
    29
    I want exactly what this script does but i want to set the localPosition and i think for that i need to set the ik.solver.target instead of the ik.solver.IKPosition

    Code (CSharp):
    1.                 Vector3 handPosRelToWeapon = weapon.transform.InverseTransformPoint(ik.solver.bone3.transform.position);
    2.  
    3.                 ik.solver.IKPosition = weaponAimTarget.TransformPoint(handPosRelToWeapon);
    4.  
     
  15. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    5
    Hey @Partel-Lang,
    I'm using VRIK in combination with SteamVR new input system. VRIK is amazing and doing a great job.
    I have one small problem though but I'm not sure it is related to VRIK and wanted your pov on this issue.

    So I use VRIK and SteamVR_Behaviour_Skeleton to get the hand poses from the vive controller and rotate the hand bones. We had to do some research to get a nice working avatar with this system. The rig and the SteamVR look like this :

    https://ibb.co/N3wWyBQ

    I've set SteamVR script to only set the rotation because the pose is controlled by VRIK, and the hands are not floating like other "VR Hands" but they are attached to the body skinned mesh.

    Everything is working super good in the editor, but it's a whole different story in a build.
    When I want to activate the VRIK Avatar with SteamVR Hands, it looks like the rotation of the wrist is wrong and not affected at all :

    This is in the editor :
    https://media.giphy.com/media/Idaoi4Q6oktwEQ3Q7K/giphy.gif

    And this is in the build :
    https://media.giphy.com/media/Vd340bLD2MQGIxUoJM/giphy.gif

    Do you have any ideas why this could happen ? I already asked on SteamVR github issues but no answer so far. And I don't really know where to look or where the problem comes from :/

    Thank you for your amazing work and support !
    Antoine.
     
  16. XavLasuite

    XavLasuite

    Joined:
    Sep 19, 2018
    Posts:
    3
    Hello I'm Xavier, I'm from France. I bought FinalIk and PuppetMaster for my VR projects. I'm currently preparing a prototype in VR and I have some strange behavior with FinalIK. I have my character embarked parented to a moving model, and as soon as the parented animator is active and the model is moving, my feet feels like i'm running. Is there some solutions, to make sure that VRIk is only moving my character when i'm moving and don't consider any transforms informations from a parent in the hierarchy? Thanks in advance. To give an other feedbacks, your plugins feel great and open lot of possibilities, but on the other hands, documentation, tutorials are kind of lacking. I'm doing lot of test to understand what I did wrong to have a character correctly working. Thanks in advance for the answers.
     
  17. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    5
    @XavLasuite
    You can disable the locomotion from the VRIK Rig when you need it like this :
    Code (CSharp):
    1. _ik.solver.locomotion.weight = 0;
    Where _ik is a reference to your VRIK component. Could that help you ?
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey, sorry for the wait!

    Nothing to do with FIK there, but PuppetMaster can make your characters bump into each other and lose balance if hit too hard.

    Hey,
    I haven't tried to do this myself, but I don't have a lot of faith in it actually working via muscels. I don't think Boneworks has that either. In many cases faked or simplified physics works much better than actual physics based solutions and that is definitely one of them. Using muscle strength would require the puppet to be completely unpinned while climbing and it would probably make your head bounce around in ways that make you sick and the hands lagging behind the controllers and stuff like that.

    Hey,
    Not sure if I understood you right, but you can set ik target position like this:
    Code (CSharp):
    1. ik.solver.target.position =
    Hey,
    I haven't seen or heard of VRIK behaving any different on build before, so I don't think it has anything to do with the solver itself. I have however come across some weird bugs in Unity, scripts running in different order in build, like this one. One day I was making a test build of a prototype project on Quest and got null refs from Start although in Editor and Windows build it was fine. That was a problem with execution order too.
    Maybe it is like that, maybe some script you have that parents IK targets to the steam hands or something like that and in build it runs after SteamVR has already moved the hand to another position... Just a wild guess, can't really debug it from here.

    Hey, thanks for the purchases!

    Please check out the "VRIK (Moving Platform)" demo, it has a solution for you.

    Cheers,
    Pärtel
     
  19. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    5
    Hey @Partel-Lang ,

    Thanks for your answer. I spent several hours trying to find the problem here and yes, it is not from VRIK !
    My fix (maybe a little bit dirty but it worked) is to prevent SteamVR_Behaviour_Skeleton to have any influence at all on the wrist bone of my character.

    I added this at the top of SteamVR_Behaviour_Skeleton.cs :

    Code (CSharp):
    1. public Transform[] ToIgnore;
    And a little bit after in the code, I turned of any transform update if the bone was in the Transform list :

    Code (CSharp):
    1.  
    2. protected virtual void UpdateSkeletonTransforms()
    3.     ...
    4.     for (int boneIndex = 0; boneIndex < bones.Length; boneIndex++)
    5.     {
    6.     ...
    7.         if (ToIgnore.Contains(bones[boneIndex])) // Ignoring bone if in ignore list
    8.  
    9.             continue;
    10.     ...
    11.  
    And it fixed it for me in the build, just had to ask gently SteamVR to not update this transform that was handled by VRIK :)
     
  20. Michael_R

    Michael_R

    Joined:
    Sep 6, 2018
    Posts:
    29
    Sup @Partel-Lang,

    yeah, i had it like that but in this script i am calculating with world positions, so is it possible to change the script to set the ik.solver.target.localPosition instead with the same end result but just with localPosition?

    What do i need to change if i want to set the ik.solver.target.localPosition (instead of ik.solver.IKPosition):

    Code (CSharp):
    1. Vector3 handPosRelToWeapon = weapon.transform.InverseTransformPoint(ik.solver.bone3.transform.position);
    2. ik.solver.IKPosition = weaponAimTarget.TransformPoint(handPosRelToWeapon);
    For example whe i set the ik target with a gameobject at the inspector of a LimbIK and then i want to set the localPosition of the gameObject instead of the position..
     
  21. Samb88

    Samb88

    Joined:
    Mar 26, 2009
    Posts:
    202
    Hey @Patel-Lang !
    First of all: I love Final IK! It's one of the best assets to bring life to a character with ease!

    I have a kinda special case.. and maybe you know what I can do to fix it.

    I have a stylized character with a unique eye shape. If he looks straight the eyes won't be in the center of the eyeball, more to the center of the face. So the build in clamp method doesn't really work for this situation. The best solution would be a way to clamp the X and Y axis seperatly, also in both directions seperatly. I tried to simply clamp the euler angles but this obviously didn't work :D

    Do you know a way to handle this? Or maybe this is something for a future update? I don't know how many use the eye solver via the LookAtIK.

    Thanks and have a great day!
     
  22. XavLasuite

    XavLasuite

    Joined:
    Sep 19, 2018
    Posts:
    3
    Hello Partel-Lang,

    Thanks, I will have a look at it. For the while, I lowered to Zero the locomation weight, but this is not uber sexy in the end. I'm looking to find a solution where it's possible to embark on a mobile object and still making profit of the locomation aspect so it keeps the same look&feel, where there is the procedural locomotion.

    To Cocapasteque, Yes, I did not went for a script solution, but went with this same temporary solution.
    Thanks. Have all a nice day.
     
  23. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey.

    Code (CSharp):
    1.  ik.solver.target.position = worldSpacePosition;
    2.         ik.solver.target.localPosition = ik.solver.target.parent.InverseTransformPoint(worldSpacePosition);
    The second line is setting target local position, but it will give you the exact same results as the first line, so I'm sorry, I still don't understand. What is the IK target parented to anyway?

    Hey,
    Please grab this update to IKSolverLookAt.cs.
    It will enable you to set baseForwardOffsetEuler for the eyes to change the base direction of the clamping.
    You can set it up with a script like this:

    Code (CSharp):
    1. public LookAtIK ik;
    2.  
    3.     public Vector3 leftEyeBaseForwardOffsetEuler;
    4.     public Vector3 rightEyeBaseForwardOffsetEuler;
    5.  
    6.     private void LateUpdate()
    7.     {
    8.         ik.solver.eyes[0].baseForwardOffsetEuler = leftEyeBaseForwardOffsetEuler;
    9.         ik.solver.eyes[1].baseForwardOffsetEuler = rightEyeBaseForwardOffsetEuler;
    10.     }
    Set eye clamp weight to 1, play the scene, then adjust the base forward offset eulers until the pupils are more or less in the middle of the eye. Copy the component, stop play mode and paste values back. Then just change LateUpdate to Start because you don't need to update that each frame.

    Another possible solution would be to use rotation limits. Add RotationLimitSpline components to the eyes and set them up to the shape of the eye. Then use a script like this to update the limits after LookAtIK is done:

    Code (CSharp):
    1. public LookAtIK ik;
    2.     public RotationLimit[] rotationLimits;
    3.  
    4.     private void Start()
    5.     {
    6.         ik.solver.OnPostUpdate += OnPostUpdate;
    7.  
    8.         foreach (RotationLimit limit in rotationLimits)
    9.         {
    10.             limit.enabled = false;
    11.         }
    12.     }
    13.  
    14.     private void OnPostUpdate()
    15.     {
    16.         foreach (RotationLimit limit in rotationLimits)
    17.         {
    18.             limit.Apply();
    19.         }
    20.     }
    Best,
    Pärtel
     
  24. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    62
    I am using VRIK with puppetmaster and usually works fine but a few times the character starts to move the arms like crazy and move the body alone not coupling with VR camera, the body tries to align with the VR camera and as times passes it becomes nearer the camera but usually doesnt match well and arms keep moving without control by themselves. When i disable puppetmaster it works so it seems there is a problem with puppetmaster
    Other times hands stay up and dont move as if i put my arms pointing up, no matter where i move my hands they stay up without moving. I have Unity 2018.3 and latests VRIK and puppetmaster versions
     
    Last edited: Jul 16, 2019
  25. unity_j-7mVMHogfwnHw

    unity_j-7mVMHogfwnHw

    Joined:
    May 15, 2019
    Posts:
    1
    Hello everyone.

    I am new to FinalIK and unity overall and I am working on a project to integrate the hi5 vive tracker gloves in a full arm with IK.

    I use 2 hands both driven by the hi5 script, one attached to the arms and the original hi5 hand which has the mesh disabled. I use a LimbIK and use the bend modifier as the original hi5 hand and apply it to the arm. I need this to maintain the hand rotation which disappears for some reason with the IK and its hand as a bend target. The arm is also parented to the camera with an offset.

    The IKs don't seem to work with this set up.
    .
    For LimbIK If I choose as bend modifier the target (the original hi5 hand) all the bones rotate at least twice than needed as far as I can tell. All other bend goals do not move the forearm and then the wrist mesh ends up twisting badly. CCD IK seems to also remove the original hi5 glove rotation.

    I attached some pictures for reference.

    I cannot see what could be the problem. The only thing I have not done is modified to the LimbIK script. I added twist relaxers and angle constraints but they don't seem to work properly either.

    It probably doesn't help that I am extremely new to this but If anyone has any suggestions and could help with this issue I would be very grateful.
    1.png 2.png
     
  26. NikkiC5

    NikkiC5

    Joined:
    Jun 11, 2016
    Posts:
    8
    Hi Partel,

    I have two Vive controllers and the Vive headset attached to VRIK animating a rigged characters in VR. What's the process to get the rest of the body to follow the head and hands when teleporting?
    I've tried setting ik.transform.position to the new position and calling ik.solver.Reset() in LateUpdate(), but the body floats in the air, pointing towards the last position before teleport. Thanks!
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    It is probably the joint limits and/or internal collisions not allowing for the range of motion that you need. Please try disabling "Angular Limits" and "Internal Collisions". If that fixes it, you'l need to either loosen the joint limits or reduce collider sizes using the RagdollEditor.

    Hey,
    If you are doing VR stuff, then LimbIK will not be good enough, as it doesn't use the shoulder and without rotating the shoulder, you will not be able to reach anything properly. Please try switching to ArmIK, that is basically the arm solver extracted from VRIK, then add TwistRelaxer on top of it.

    Hey,
    Could it be that you were doing the teleport in FixedUpdate, but the ik.solver.Reset stuff in LateUpdate?
    At least that is the only scenario I can think of right now, that could cause something like that. Is the problem visible only for a frame or two? If this is the case, make sure to move the root of the avatar to the new position and call ik.solver.Reset from the same method you use to move the camera.

    Best,
    Pärtel
     
  28. 4rok

    4rok

    Joined:
    Jul 18, 2019
    Posts:
    1
    EDIT:
    Kinda works now with Steam VR Plugin Version 1.2.3.
    Before I used Steam VR 2.3.2 (sdk 1.4.18).
    Thanks!

    Hi Pärtel,
    I just bought your asset and have a weird problem and I can't figure out how to solve it. I broke it down to this:
    I am using the Vive Pro HMD and two controllers. If I open SteamVR VRIK sample scene (with the pilot), the character is weirdly twisted. It seems that the rotation axes (of the head/character) are not aligned with the camera rig axes. For example if I hold the headset up and turn it 90 degrees to the side and then again turn it (like you would turn your head to your shoulder), then the pilot character finally stands correctly, but of course the camera now looks into a completely wrong direction.
    This twisting happens with all models I have tried, the ones from you asset and one I got from a friend. With the last one I also noticed the following: If I assign the bones (without even assigning head and hand targets) and then start the scene, the left and right arm are crossed through the character. I figured that maybe left and right are swaped, but when I tried this the arms now point in the right directions, but now the soulders pop out of the front.
    I don't know, maybe I am missing something here, I even watched your tutorial videos on youtube, but it just doesn't work..
    Thanks and enjoy your day!
     
    Last edited: Jul 20, 2019
  29. NikkiC5

    NikkiC5

    Joined:
    Jun 11, 2016
    Posts:
    8
    Thanks for the reply. I have somehow resolved the issue by removing the VRIK component and it adding again.
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    That might have something to do with the SteamVR version, it has been updated a number of times since the current integration. I have very recently updated my SteamVR integration, you can pull it from here (Unity min 2017.4.28f1, SteamVR v2.2.0).

    Best,
    Pärtel
     
  31. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    62
    I disabled both and the hands are still appearing up some times
     
    Last edited: Jul 25, 2019
  32. bbaugh007

    bbaugh007

    Joined:
    Jul 23, 2018
    Posts:
    8
    Hey, I was thinking about buying this but was unsure if it was what I needed. I am working on a third person game with melee combat in which you cam aim and stab enemies in specific places like a third person shooter, similar to what is done in the video below at around the 5 minute mark.



    I was thinking aiming IK would be good to help ensure that the character's weapon is aiming at the right location, but was wondering if the ik would interfere with the attack animation and if the arms would still be pointing in the right direction during the stab animation or would I have to code something to get that to work properly.
     
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    If it's not that, then it is very difficult to guess based on just that information, could you record a video or something like that please? You can send it to support@root-motion.com or PM me if you'd prefer to keep it private.

    Hey,
    Yes, AimIK was designed for cases just like that. Normally AimIK would keep your weapon locked aiming at the target at all times and that would mess up your attack animations. But there is a way to make AimIK work in additive mode. All you need to to is add AimController on top of AimIK. That is a tool that takes care of all the smooth weight blending and target switching for you. It also has the "Use Animated Aim Direction" toggle and if you enable it, you'll get to keep all your animations with the weapon still generally pointed towards the target.

    If it is a two handed weapon, the easiest would be to only use the spine bones for aiming, because if you also used the arm bones, that will make the other hand lose contact with the weapon. It is possible however to use a pass of LimbIK on top of AimIK to put the other hand back to where it was relative to the weapon before AimIK solved.

    Cheers,
    Pärtel
     
  34. Hukha

    Hukha

    Joined:
    Aug 12, 2013
    Posts:
    28
    Hi @Partel-Lang
    Im working With OffsetEffectors in a Quadruped. The OffserEffectors are parented to differents parts/bones of the body.
    I move this effectors well and looks good, but the "Idle" state of the effectors (When i dont move the effectors) is strange.
    I explain:
    If i dont have the effectors parented to the Body works perfect (But obviously i dont have the effectors just where i needed), the effectos seems to have like a "initial position"(The No-Offset position).
    Any way to solve this? restart the "initial position"? (How?) Move with Transform.localPosition? (I tried a long time, but i cant make it work... Seems to accumulate the "new" positions of all bones...)
    Any help? Thanks!

    EDIT: The problem was in the rotations of the targets. Now its working perfectly!
    BTW, i want to make the ears of my quadruped like "bouncy" with inertia and the Inertia Script dosent work fine with a quadruped, any idea?
    Thanks and sorry!
     
    Last edited: Jul 26, 2019
  35. bbaugh007

    bbaugh007

    Joined:
    Jul 23, 2018
    Posts:
    8
    Thanks for the info!
     
  36. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    34
    Hi,
    I'm using a Mixamo character, specifically these two characters.
    The elbows are always bend. I read the previous posts and the answers were to bend the elbow in the inspector to match the starting pose. I tried to do that, it did not help. The character still has weirdly bent elbows.
     

    Attached Files:

  37. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    34
    I also checked the rotation of the elbows, it seems right.
     

    Attached Files:

  38. mackerbaehr

    mackerbaehr

    Joined:
    Apr 6, 2014
    Posts:
    2
    Hello.

    From an animators/filmmakers standpoint regarding Puppetmaster: is the output of the character simulation exportable to fbx, to be used outside Unity?
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    Inertia works only for the body parts that are a part of the FBBIK rig, like hands, body, shoulders. For bouncy animation on ears and tails and stuff like that, I'd recommend you to check out Dyanmic Bone by Will Hong.

    Hey,
    When you select the gameobject that has the FullBodyBipedIK component on it an look at it in Scene View, do you see the little blue arrows on the elbows pointing in the natural bending direction of the elbow? Or do you see yellow/red dots on the elbows?

    Hey,
    I do have a WIP baking tool that can bake Final IK and also PuppetMaster to a .anim clip in Unity, works for both Humanoid and Generic rigs. I don't have an fbx export tool, but I've heard beta testers were able to export them using Unity's FBX Exporter tool or similar.

    Best,
    Pärtel
     
  40. M_Jud

    M_Jud

    Joined:
    Aug 1, 2019
    Posts:
    1
    Hello! Great Tool you created there!
    I just wanted to ask if there exists any possibility with the grounder to avoid knee popping when going down a slope? or is it my rig that needs to be upgraded somehow?

    Kind regards
    Miriam
     
  41. bbaugh007

    bbaugh007

    Joined:
    Jul 23, 2018
    Posts:
    8
    Hello!

    I finally have your tool now and I am finally close to having my meless aiming system done. I am still however having some issues with polish. When I aim and have the player go through his stab animation, the sword does point exactly at the position of the aim target. I am using aimIK and aimController. I was wondering if there were any settings I could adjust or any code I would have to write in order to make it more precise like a bellet flying out of a gun would be. The combat system I am working on involves being able to stab specific parts of the enemy, but currently it is very hard to have a crosshair that accurately represents where the point of the sword will go. I have attached screenshots of my setup as well. Any help would be greatly appreciated.

    IK_1.PNG IK_2.PNG IK_3.png
     
  42. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    Does the knee popping look just like the knee straightening out very sharply? You could try just increasing "Pelvis Speed" in the Grounder, so it moves down faster, avoiding the need to stretch out the leg too much.

    Hey,
    With AimIK alone you can only reorient the animation to another direction, it does not assure the sword tip reaching a specific position. If it is a stabbing animation, you might be able to achieve that pretty easily though, just by running a few lines of code on top of AimIK that rotates the hand bone to make the sword point turn exactly towards the target when it is supposed to hit:

    Code (CSharp):
    1. Quaternion correction = Quaternion.FromToRotation(hand.rotation * swordAxis, target.position - hand.position); // Rotation towards the target
    2. correction = Quaternion.Slerp(Quaternion.identity, correction, correctionWeight); // Smooth blending of the effect
    3. hand.rotation = correction * hand.rotation; // Apply the correction
    You can use an animation curve (make one in animation import settings) to make that correctionWeight start from 0 and go up to 1 by the time of the hit and then back to 0 again.

    You can use ik.solver.OnPostUpdate delegate to get a call from AimIK each time after it updates to run that bit of code.

    Best,
    Pärtel
     
    bbaugh007 likes this.
  43. bbaugh007

    bbaugh007

    Joined:
    Jul 23, 2018
    Posts:
    8
    Thanks! What is the swordAxis referring to in the code example there? Is your example for an entirely new script that I would write or a modification of one of your files?
     
    Last edited: Aug 8, 2019
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    swordAxis would be the local axis of the hand bone that points towards the tip of the sowrd.
    This is how you can use IK solver delegates like OnPostUpdate:

    Code (CSharp):
    1. using RootMotion.FinalIK;
    2.  
    3. public class StabAiming: MonoBehaviour {
    4. public AimIK ik;
    5.  
    6. void Start() {
    7. ik.solver.OnPostUpdate += AfterAimIK;
    8. }
    9.  
    10. // Called by AimIK each time after it updates
    11. void AfterAimIK() {
    12. // correction code goes in here...
    13. }
    14. }
    Best,
    Pärtel
     
    bbaugh007 likes this.
  45. bbaugh007

    bbaugh007

    Joined:
    Jul 23, 2018
    Posts:
    8
    Thanks! So if the y axis points towards the sword tip, I would use that?
     
  46. MiriamTschanen

    MiriamTschanen

    Joined:
    May 20, 2019
    Posts:
    2
    Hi,

    Not sure if this has been asked before, I apologize if it has but I couldn't find anything. Does FinalIK output some response or warning if provided with an impossible set of constraints? For example, if I have my character pick up something that it cannot possibly reach, the arm will stretch as far as it can go and that's it. Is there a way to detect this case?

    Best,
    Miriam
     
  47. Devistute

    Devistute

    Joined:
    Aug 23, 2014
    Posts:
    32
    Hi! Is there a way to make the character lean forward when climbing stairs or slopes?
    Would give points to realism.
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,908
    Hey,
    No, it doesn't really know if it is able to reach or not before it actually tries.
    But you could check in LateUpdate the distance of the hand target from the shoulder. If it is greater than arm length, it will not reach.
    With FullBodyBipedIK, if you set "Pull" to 1 for the reaching hand and 0 for the other hand and legs, it will always reach.

    Hey,
    Yes, it is quite easy if using GrounderFBBIK. Check out the grounder settings of the Pilot in the "Grounder" demo. On the bottom you'll see "Spine" and if you expand it, some effectors linked to it. That does the leaning for you.

    Best,
    Pärtel
     
  49. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    76
    Hey @Partel-Lang,

    I'm making a first person game, it's a caress simulator with precise hand and fingers IK. I would like the arm to stretch to carsses objects that would not be reacheable otherwise (imagine the manga "One Piece"). For that I'm using a limb arm IK and setting the hand bone position to the target in late update. (so that the arm stretch if it's too small to reach the tagret)

    But I have a problem with my finger Ik : for that I used a CCD Ik. And when the hand is streched, the ccd does not update and seems to stay at the default pos of the hand.
    I already tried to update the ccd solver each frame in late update, but it's giving me flickering (between the good and the default pos)

    This is how it should be :



    And this is how it is when stretched :



    Would you know how to help me with that ?
    Thanks in advance,

    Jonathan
     
    Last edited: Aug 13, 2019
  50. HoneyTribe

    HoneyTribe

    Joined:
    Mar 7, 2013
    Posts:
    16
    Hi @Partel-Lang

    We recently started using Final IK and it was working very well. Then we implemented the Ultimate Player Controller, including the Final IK Bridge component, and now we see sudden frame rate drops, going from 60+ fps to 5 fps very often. When we disable the Final IK Bridge component, the frame rate is stable again (and Final IK no longer works of course). Alternatively we can make the frame rate stable by changing the weight in Grounder FBBK to 0 (which also disables all that Final IK magic). Do you have any guidance on what we need to do to have Final IK working and have a stable frame rate? We're using Unity 2019, currently 2019.2 but have been using this setup since 2019.1

    As extra info I'll add that when Grounder weight is 1 we see rapid jittering in the character model, as if it is receiving conflicting values every frame.

    Thanks,
    Shaz