Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang Hello Thanks for Answer, We are still on 1.9 Cause I'm not sure if new version works with Slate Cutscene System Properly, I will check Release note and Think about upgrade, What do that EditorIK component exactly?

    P.S Also can we delete Shared Demo Asset from our project to keep disc/ server space?

    P.S Update to 2.0 I noticed that GRoudner becomes to work differently now it won move up my character to the ground but move just his foots, what makes strange effects. Lift Pelvis Weight Set to 1 gives strange effects like it would be more than 1 when using walk animation, Are YOu sure there is no bug here now?

    OVerall We would like to Reorder SCripts Cause There is a problem with Grounder and Look at IK, cause If You Set Lift Pelvis, and then Move character Root Upsite Character stays on ground, but Look At position is caculated still according to Root that is in Air, this is why Look at ik should be after FBIK in my opinion.
     
    Last edited: Nov 27, 2020
  2. Immersive-Matthew

    Immersive-Matthew

    Joined:
    Mar 24, 2020
    Posts:
    26
    Hello @Partel-Lang,

    I am wondering if there is anyway to reduce the jittery legs that you see on the little girl in this video? I am animating with VR IK and a Valve Index with 8 Vive Trackers plus 4 lighthouse base stations so plenty of data points to make things smooth. In a number of experiments I noticed that whenever I stomp, the legs get all jittery, yet the Vive Trackers which I have models of in VR, are rock solid and are not jittery. In fact, I have the trackers all very tightly strapped and supported to ensure they do not jitter. For the legs I have trackers on the top of each foot as close to my ankle as I can (more stable here), some on each of my knees (tried both above my knee and below both yielding the same result) and one on my waist right where a belt buckle would be. I have messed around with goals and weights and have not been able to discover any improvements. I also noticed that when I stomp a little harder or jump, that my my feet when they hit the ground appear to go into the floor up to my ankle for a split second. This might be the smoking gun here as it sort of indicates, at least to my ignorant VK IK inner workings knowledge that perhaps it is a sampling issue as for sure the Vive trackers do not go into the floor. It is almost like VR IK is sampling the trackers at a lower rate than Lighthouse tracks them (120Hz) and then it predicts the location before the next sample? I am grasping here as like I said I really am ignorant on how it all works behind the scenes, but that is my theory based on the evidence of my foot erroneously going into the floor. I did play with the frame rate but this too seem not to have any impact as well as plant feet. Any tips on how to reduce or eliminate this jitter or am I hitting the limits of this technology?



    Much appreciated,
    Immersive Matthew
     
    Last edited: Nov 28, 2020
    ROBYER1 likes this.
  3. insane245

    insane245

    Joined:
    Jun 28, 2016
    Posts:
    4
    Hi @Partel-Lang . I've been using Final IK and Puppet Master, but I can't get Aim Boxing to work together. It seems that whenever I use Puppet Master it completely derails how Aim Boxing works. Is there a specific way to setup the character to use all of these features, or do you think I'm missing something? For example, if you go into the Aim Boxing demo scene and add a Biped ragdoll and full body IK without changing anything, the Aim IK becomes broken.

    Here's what I'm experiencing with my player controller. I've deactivated Puppet Master and Final IK, hope you can help me with this.



    I'm trying to punch the enemy, and have the Aim Boxing script attached to the Puppet Master head (of the enemy). This is what I have on my player: I've tried every Axis configuration and that doesn't seem to help either. Any ideas? Thanks!


     
    Last edited: Nov 28, 2020
  4. arie1994

    arie1994

    Joined:
    Jun 30, 2016
    Posts:
    81
    I upgraded my project to 2020.1 and biped ik started to push the characters hips to the side in a weird way,
    even if body effector weight is 0 (master weight at 1 so I can use hand effector).
     
  5. unity_7f3mcYK7lJt-HQ

    unity_7f3mcYK7lJt-HQ

    Joined:
    Mar 27, 2020
    Posts:
    1
    Hello @Partel-Lang,

    I try LimbIK and GrounderIK with my animation, but leg rotate the wrong way.
    I want to know how I can fix this problem.

     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    Yes, you can nuke Shared Demo Assets, but that would make all the demos broken, would have to delete those too.
    To remove all demos you'd have to also delete Baker/_DEMOS, FinalIK/_DEMOS and Editor/FinalIK/_DEMOS.

    About Grounder lift pelvis weight stuff, can you please share a screenshot of your Grounder solver settings?

    To change IK update order, can just use the IKExecutionOrder component.

    Hey,
    Looks like the jittery is mostly or entirely the bend angle of the legs changing rapidly. If you set Bend Goal Weight to 0, does it go away? If so, might want to move the bend goals a meter or so away (in forward direction) from the knees.

    Hey,
    Aim Boxing demo stops working when you add PM just because the Aim IK and Pin fields go missing in the AimBoxing component (on the "Aim Target" gameobject). When you re-assign them, it will work again. It happens because when you set up PuppetMaster on a character, it duplicates itself and removes all non-ragdoll components from the original. The recommended way of setting up PuppetMaster would be to drag a new instance of the model to the scene, creating a ragdoll on that, adding PM to it, then assigning the original as "Animated Target" before you click on "Set Up PuppetMaster". That way PM will not have to duplicate/destroy anything and all your existing references and other stuff remain intact.

    Hey,
    I tried BipedIK in 2020.1, didn't see any problems and can't think of anything that could cause one on Unity upgrade, I mean the math is the same. Could you please let me know how to reproduce the issue or send me a repro package or something I could take a closer look at here?

    Hey,
    LimbIK samples the pose at Start to find out which way the limbs are bent. That model must have the legs bent slightly sideways, so just rotate the knee bones in Editor a bit.

    Best,
    Pärtel
     
    Immersive-Matthew likes this.
  7. onefoxstudio

    onefoxstudio

    Joined:
    Sep 28, 2016
    Posts:
    56
    Hi ! Can't get Interaction to work with FPS Camera ... weirdly.
    I don't get any Interaction In Range to show; if i use Character Position it works smoothly.

    What am i missing here ?

    I have the BranchPickup GameObject with EventTrigger and a dummy LookAtSphere
    Capture d’écran 2020-11-30 à 15.13.24.png
    Capture d’écran 2020-11-30 à 15.30.26.png

    And the Interaction System.

    Capture d’écran 2020-11-30 à 15.11.25.png
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    I see you have Direction set to (0, 1, 0), so is the local green axis of the LookAtSphere pointing towards the camera?
    Other than that, difficult to say from here without more information.
    If you have a bit of scripting experience, could take a look at InteractionTrigger.cs public bool IsInRange at line 200. Add Debug.Log before every "return false" to see what exactly is preventing it from being added to triggers in range.

    Best,
    Pärtel
     
    onefoxstudio likes this.
  9. onefoxstudio

    onefoxstudio

    Joined:
    Sep 28, 2016
    Posts:
    56
    Ok after re-creating the pickup i figured out i had another trigger left in the root hierarchy; he wasn't the one in the collider list. All solved ! Thanks !
     
    Last edited: Nov 30, 2020
  10. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang We cant use Execution order script as I mention Cause We would like to change That behaviour also in editor preview (when using slate cutscene system) so as I assume only way to change Look at IK after FBIK also in editor (not only in playmode) is change hardcoded execution script order value in script? (What about FBIK grounder I will send you some screenshot soon ;) ) For me its just little bit odd behaviour when using Lift Pelvis to 1 value.
     
  11. WeAreAteatar

    WeAreAteatar

    Joined:
    Apr 10, 2018
    Posts:
    1
    @Partel-Lang First, thank you for developing and actively supporting this amazing asset!

    I am using VRIK with VRIF and I have one problem that I can't solve. My XR rig uses Character Controller with capsule collider and VRIF uses some custom script to deal with y offset of the headset to ground Player. This works on flat surfaces at y=0. When I move to something that is lower than y=0, my head is tracked properly but my feet stay on the y=0 level. This applies to elevaring to platforms where y>0 as well. I tried using VRIK grounder (as in VRIK Grounder scene) but I guess the problem is with character root ie position of capsule collider which defines character. Is there any way to get this done without changing current character controller?
     
    unitydreamer29 likes this.
  12. Eman_resu

    Eman_resu

    Joined:
    Nov 26, 2019
    Posts:
    7
    Hello everyone! I would like to create a system of steps when my character bipod rotates the body when stationary, the same system as the mech spider with CCD IK or VR IK. Thank you for any help.
     
  13. Immersive-Matthew

    Immersive-Matthew

    Joined:
    Mar 24, 2020
    Posts:
    26
    Thanks so much for the reply and being active on here. In response to your note, I had the blend goal weight at 0 already, and played with all the settings in this area to see if they could help. Today I moved the bend goal further out as it was close to 1 already, but close or far makes no difference to that jitter. To rule out the trackers bouncing I manually pulled them back hard and let them snap back into place on my knee and foot and to my surprised my leg hardly jittered at all so I am fairly confident this is not a tracker physically jittering issue. I am suspecting it is the sample frequency. I am using OpenVR to track the lighthouse Vive Trackers and I am wondering if perhaps OpenVR, VR IK or Unity itself has a lower tracker frequency than what lighthouse is putting out. Do you know what frequency they track at? I am at a loss as to what else I can try as like I said, I have messed with every setting and while they all doing something, none seem to impact the jitter. Have you seen this before with faster movements and is this perhaps just a limitation of the tech right now (OpenVR,,Unity or VR)?


    UPDATE: It is Lighthouse!!!! When I stomp hard my foot tracker goes right though the floor for a blink of an eye and surely is messing VR IK up. When I looked down at my foot from above < I could not see it, however when I sit down on the floor and kicking my heal into the floor I can see it clearly. It can go as much as 30cm through the floor with a stomp comparable to getting some mud off your boots. A lite stomp of jump like in my clip go into the floor about 5-10cm. Gosh...I thought lighthouse was better but I did read that despite the 120hz refresh, due to some internal stuff between stations, it is effectively 60hz. This is no better than the Oculus Quest, which I did an extensive video on why they also fail in similar ways. Interesting watch for anyone struggling with fast motion VR IK.


    Thanks again,
    IM
     
    Last edited: Dec 3, 2020
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    You can always just disable the IK components and call ik.solver.Update() whenever and whichever order you need.
    But in editor mode it is more complicated because the solver needs to be initiated with the character in it's default pose. That is a problem, because whenever your scripts are recompiled, it needs to be re-initiated. All that is what the EditorIK component was designed to deal with.

    About the Grounder, would you like me to send you the 1.9 version of it that you could use with 2.0 of the rest of FIK?

    Hey,
    All you need to do basically is keep the avatar root's y at the same level as the Character Controller.

    Code (CSharp):
    1. ik.references.root.position = new Vector3(ik.references.root.position.x, characterController.position.y, ik.references.root.position.z);
    Because VRIK doesn't do that on it's own and neither does the Grounder, that only handles foot placement correction.

    Hey,
    The way both the mech spider and VRIK locomotion does that:
    1. Store the rest position and rotation of each feet relative to the character at Start
    leftFootRestPos = character.InverseTransformPoint(leftFoot.position);
    leftFootRestRot = Quaternion.Inverse(character.rotation) * leftFoot.rotation;

    2. Use those to calculate ideal positions/rotations for the feet each frame
    Vector3 leftFootIdealPos = character.TransformPoint(leftFootRestPos);
    Quaterion leftFootIdealRot = character.rotation * leftFootRestRot;

    3. Check for distance between the left footstep position and leftFootIdealPos, same for rotation angle. If they are greater than a certain threshold, initiate a stepping procedure aiming to take the foot target to the current ideal position.
    Basically just use a timer going from 0 to 1 and use that interpolate the position/rotation of the foot target from it's last position to the new one.

    Then use IK to pin the feet to the footsteps.

    Hey,
    Interesting....
    What you could try is apply some interpolation to the knee goals. Make them smooth-follow the tracked positions over time, that ought to mask out those tracking extrapolation issues.

    Cheers,
    Pärtel
     
  15. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang Thanks for info, What about EDITOR IK How to create that defeault pose? and what exactly it is? Sorry but I cant find any info in documentation about it. If there is something please share link with me :)

    Also last question, We are using mainly Your system to our game cutscenes, (using Slate cutscene editor) and We noticed that there is a problem with different position or Limbs Editor vs Playmode, if character that use Final IK have animator component with IK pass turned on. Overall coudl it have any impact here? Should we disable Animator IK pass when using Final Ik ?

    And last think on some heroes FInal Ik makes effect of sliding foots even with standing animation (With FBIK turned off that dissapear so animation is ok) Why is like that and how to avoid that?
     
    Last edited: Dec 4, 2020
  16. bzonca

    bzonca

    Joined:
    Feb 28, 2014
    Posts:
    10
    Hey @Partel-Lang,

    I first want to say how amazing final IK has been for me and it's amazing how active you are with replying to support -- it really goes a long way. I have been wrestling with one small issue that is driving me nuts, and I think it has something to do with how I set things up.

    In summary, the issue that I am having is with Aim IK. Aiming direction and animations are both correct, but spawning a muzzle flash with muzzleAnchor.postion (along with other effects), behaves as if it completely ignores the aim IK. I have ruled out the spawning method since it is simply enabling a pooled object, and setting it's global pos/rot to the muzzleAnchor's pos/rot. The muzzleAnchor is several children down from the last Aim IK bone, and appears to always be at the correct pos/rot in the editor since it is just an empty child.

    I have attached some cases that better explain my point.

    Here is what I have tried:
    - Enabling/Disabling IK on all animator layers fails to produce a result
    - Setting the aim IK weight to 0 gets the muzzle flash to spawn where it should, however aiming is obviously off since it is disabled
    - Turning off the entire animation spawns muzzle flashes at the correct position AND aiming is correct, however there are now no animations.
    - Since AimController (from the examples) is being used to control AimIK, I tried enabling "AnimatedAimDirection" which spawns the muzzle flash in the right position, however the character no longer aims at the target (same result as setting weight to 0). The AimController and any other IK scripts are completely untouched so I didn't change anything.
    - Changing the weights in the animator layers seems to do nothing. Setting all the layers to 0 still makes the effects off. Actually deleting all of the layers still produces the issue. Only complete disabling it will allow proper aiming + effects (but no animations).

    I hope this explanation is thorough enough and I appreciate your time. I'd be happy to give you any more info if you need it. Thanks again.
     

    Attached Files:

  17. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    243
    Hi,

    Issue with integration result from opsive ucc and final ik.

    The issue is when I add the limbik.

    When I setup limbik (left shoulder, left arm, left hand), and have the character root selected in the hierarchy everything is fine, however when I click off the character root in the hierarchy, there is a huge jitter on the limbs used in limbik (especially left hand).

    Any ideas on how to solve this (asking on opsive as well)?

    EDIT: @Partel-Lang What I am really trying to do above is to solve the issue of hand placement when using a weapon. Justin from Opsive suggest that I try FullBodyBipedIK instead of limbik, which I am now attempting, however I am stuggling to convert the code you supplied previously though the WeaponHoldOffset.cs script.

    The lines I am trying to change are:

    Code (CSharp):
    1. leftHandIK2.solver.IKPosition = leftHandIK2.solver.bone3.transform.position + rightHand.rotation * weaponParams[currentWeaponIndex].leftHandPosOffset;
    2. leftHandIK.solver.IKRotation = Quaternion.Euler(weaponParams[currentWeaponIndex].leftHandRotOffset) * leftHandIK.solver.bone3.transform.rotation;
    3.  
    I just dont know how to convert this to FullBodyBipedIK logic.

    EDIT: I have solved this through another method.
     
    Last edited: Dec 6, 2020
  18. Eman_resu

    Eman_resu

    Joined:
    Nov 26, 2019
    Posts:
    7
    Thank you so much for your help! Now I have only one problem, when I walk with the character, the feet rightly continue to seek a foothold, adding up with the walking animation. It's not pretty to see... how can i activate the IK steps system only when the "Idle" animation is active? Thanks again!
     
  19. pavel05456

    pavel05456

    Joined:
    May 6, 2020
    Posts:
    2
    Hello! Please help with the task!

    I apologize in advance, as I translate via google translator

    I am using AimIK and AimController. Everything works well if I only keep the aiming animation. But I want to keep the agent in a idle position until the target appears in his field of vision. And when she appears, the agent must raise the weapon and start aiming.

    To do this, I have the IdleWithWeapon animation and the Aiming animation. And when the agent stands in the IdleWithWeapon pose, then it bends as in the picture below. If he starts Aiming animation, then is ok.

    I tried to enable / disable AimIK in the script, but then the aiming turned out to be too jerky and unrealistic.

    Tell me how you can organize this transition, please. I need the agent to raise the weapon and track the target at the same time.

    upload_2020-12-6_0-10-51.png
    upload_2020-12-6_0-11-52.png
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    So add an EditorIK component, assign the "Animator" slot, then do Create/Final IK/Editor IK Pose. That creates the EditorIKPose asset for you, which you can drop into the "Default Pose" slot. Then a "Store Default Pose" button appears and after you click that, can cllick the "Start Solver" pose and then you are all ready to use the solver in editor mode.

    About the foot issues. If you have IK Pass turned on, that should not affect anything unless you use Unity's built-in IK. If you have the "Foot IK" enabled, then that affects retargeting. About FBBIK making feet sliding, would it be possible for you to send me that character fbx and the animation so I could take a closer look here?

    The problem is the muzzle flash is just spawned before AimIK has updated for the frame. Use LateUpdate of a script that has higher value in the Script Execution Order than AimIK has or use the ik.solver.OnPostUpdate delegate.
    If the muzzle flash is a ParticleSystem, then it is more complicated as you can't change when particles are updated. Please check this answer here for possible solutions.

    Hey,
    Basically you'd just have to blend in IK weight when the idle animation starts and blend out when it exits.
    There are a few ways to do that. One would be to use animator.GetCurrentAnimatorStateInfo(0).IsName() or IsTag() to check if the idle animation is playing.

    Could also use StateMachineBehaviours to enable/disable the IK.

    Could also use animation events or curves.

    Hey,
    You can make AimIK work in additive offset mode, that way you'll be able to use it with all your recoil, reloading, equipping, etc animations too. The easiest way to do that would be to add the AimController component. That is a helper tool for AimIK that takes care of that (will have to enable "Use Animated Aim Direction") and other stuff like smooth target switching, weight blending and root rotation.
    If the aiming becomes inaccurate, it is because in the aiming animation the gun is not aiming exactly forward and you will have to tweak the value of "Animated Aim Direction" to fix it.

    Cheers,
    Pärtel
     
  21. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang Thanks for the clarification. I understand now how to create that Default pose, But you still didn't explain what is the purpose of it? Is that a default T-pose of character? Should we always use that default pose for characters or only for some specific cases? If there is something more about it in the documentation I will be grateful for link. Cause We still have to small information to properly understand that default Pose behaviour and use case/
     
  22. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    76
    Hey @Partel-Lang I just updated my final IK and found Arm IK. Is their some documentation on this component somwhere? I already have Final IK set up in my VR but was wondering if this helps with elbow prediction or something?
     
  23. bzonca

    bzonca

    Joined:
    Feb 28, 2014
    Posts:
    10
    Thanks for your help! I had the LateUpdate going but updating the execution order fixed it.
     
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    I just added that new EditorIK in the latest version, so don't have a documentation for it yet.
    The purpose of the default pose is only to make sure that whenever the IK is initiated in Editor, it always initiates with the character in the same pose. It is required because the IK solver samples the pose when it is initiated to find out which way to bend the limbs and some other stuff.
    Also when you update IK in editor, having that default pose stored makes you able to reset the character to that default pose at any time you need. Without it the IK would solve on top of it's own results every time it is updated in editor, messing the character up eventually.
    It is not a T-pose, it just holds whatever pose the character is in when you click on "Store Default Pose".

    Hey,
    ArmIK is VRIK's arm solver extracted from the rest of VRIK for people who only need to solve the arms (for example when your first person model only has arms), so if you are already using VRIK, it will not help with anything.

    Best,
    Pärtel
     
  25. pavel05456

    pavel05456

    Joined:
    May 6, 2020
    Posts:
    2
    Hello!

    I am using AimIK and AimController. The settings are the same as in the demo scene AimController.

    And everything worked well, but today I went into Unity and the character is not aiming accurately. The strangest thing is that I have changed absolutely nothing. The character simply stopped aiming correctly.

    This gray laser emanates from the AimTransform and misses the target. As you can see, the aimTransform (pink line) itself does not come out of the muzzle of the weapon, but goes a little obliquely.

    Tell me how i can fix this? I really don't know what the problem might be.

    upload_2020-12-11_20-18-43.png upload_2020-12-11_20-20-20.png
     
  26. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang Ok but as I assume it works only in Editor, cause in play mode it always takes default pose? I just would like to get exactly the same animation in build and editor preview, this is why I'm asking
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    I noticed in the screenshot you have the Neck bone assigned to AimIK's Bones, but the Aim Transform is not in the neck's hierarchy. All the transforms used in Bones must be ancestors of the Aim Transform, not in a sibling hierarchy or anywhere else, so you should remove the Neck from the list. Rotating the neck bone has no effect on the position/rotation of the Aim Transform, so that's why it can't be included.

    If that doesn't help, do you have "Use Animated Aim Direction" enabled or disabled in AimController?

    Yes EditorIK is only meant to be used in Editor. It will work exactly as it does without EditorIK in play mode/build. In play mode whatever pose the character has at Start is used as the default pose. Only difference is that in play mode you won't have to serialize the default pose and reset the model to it after the solver stops because all memory from play mode is nuked when you stop play mode and everything will be restored to as it was before you started to play.

    So basically in Editor mode, click "Store Default Pose" once when you add EditorIK, click "Start Solver" to use it in editor. Before you enter play mode, click on "Stop" and "Reset To Default Pose", so in play mode it would start from the same pose.

    Best,
    Pärtel
     
  28. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    743
    Hi @Partel-Lang. I have a (probably) silly question: I'm trying to use BipedIK and GrounderBipedIK to keep the feet of my character on the ground but I just can't find where to input the toe bones of the feet.

    I can see Left Foot in the Solvers sub section but there's only room for 3 bones. So I suppose "Left Foot" actually means "Left leg"? Which would be upper leg, lower leg and ankle bones. But again that would leave out the toe bone. So, where would I input that...? :)

    Also there seems to be a display bug with the Biped IK custom inspector in that if you unfold the Solvers sub-section everything appears twice (cf. picture below).

     
  29. jorikito

    jorikito

    Joined:
    Apr 20, 2018
    Posts:
    17
    Hey guys, this asset seems super powerful! However I cannot seem to find a tutorial or explanation on how to create a procedural animation with IK for a bi-pedal mech. I've tried making use of the code from the spider mech CCD example, but for bi-pedal the legs do not seem to want to move correctly :p. It's probably something to do with the fact that the spider in the example has 6 legs and they wait for syncing with other legs? (My best guess).
    I would be grateful for anyone who knows of a good tutorial!
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    The Grounder doesn't (need to) use the toe bone at all, it only takes upper leg, lower leg and ankle. It rotates the ankle bone to align it with the terrain. What exactly do you need that toe bone for? Is it the Ghost of a Tale mouse that has very long feet?

    About the display bug, thanks for pointing that out, hadn't noticed that. Looks like Unity changed a default variable's value at some point, please grab this patch to fix it.

    Hey,
    Don't have a tutorial for specifically that, but the way both the mech spider and VRIK locomotion does that:
    1. Store the rest position and rotation of each feet relative to the character at Start
    leftFootRestPos = character.InverseTransformPoint(leftFoot.position);
    leftFootRestRot = Quaternion.Inverse(character.rotation) * leftFoot.rotation;

    2. Use those to calculate ideal positions/rotations for the feet each frame
    Vector3 leftFootIdealPos = character.TransformPoint(leftFootRestPos);
    Quaterion leftFootIdealRot = character.rotation * leftFootRestRot;

    3. Check for distance between the left footstep position and leftFootIdealPos, same for rotation angle. If they are greater than a certain threshold, initiate a stepping procedure aiming to take the foot target to the current ideal position.
    Basically just use a timer going from 0 to 1 and use that interpolate the position/rotation of the foot target from it's last position to the new one.

    Then use IK to pin the feet to the footsteps.

    Best,
    Pärtel
     
    jorikito and Seith like this.
  31. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    743
    Thanks for the patch @Partel-Lang !

    Yes, that would be the mouse with very long feet... :) Having the character's toes gently curve over a rock (or its edge) really brings a plus. Or else the feet would feel like flat planks of wood. The toes would need to rotate up/down by a maximum of 40 deg or so. What do you think would be the best way to achieve this?
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    Wrote this ToeGrounder script for you (also import the updates to Grounder that are included in the package)

    Add it to the Grounder gameObject, assign the toe bones and parent new empty gameobjects to the toes, place them at the tip of the toes, assign into the "Tip" slots.

    Cheers,
    Pärtel
     
    hopeful and Seith like this.
  33. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    743
    Thank you @Partel-Lang! That works perfectly. You're probably being told that a lot but you're doing a top-notch job at supporting your assets. Unity should hire you! :D

    Now just a question: In the future when I update Final IK via the asset store, will this break anything with the ToeGrounder script? Or will you include it in Final IK itself?
     
  34. CompuGeniusPrograms

    CompuGeniusPrograms

    Joined:
    Aug 27, 2018
    Posts:
    40
    Hey @Partel-Lang. I am lost when it comes to "weights" and such, and I was hoping you could provide me with a tutorial or documentation from somewhere explaining it, as all I found were for helping riggers, and I couldn't find how to incorporate that into Final IK. I was wondering if you could perhaps help me with the Twist Relaxers script, as it seems that when you updated the script, you didn't update the demo scenes. I'm confused by the parameters you adjust, such as Weight, Parent-Child Crossfade, and Twist Angle Offset. Thanks in advance!
     
  35. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang
    Hello I have one more qestion about Editor IK, cause we are using SLate cutscene sequencer and sometime there is situation from example when playing cutscene from middle, that Final ike behaves differently than playing cutscene from start. Could You let me know if Adding Editor IK could fix that problem, or additional control of Editor IK will be needed?
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hi,
    Pretty sure I updated the demo, perhaps it was not updated if you didn't delete the old FIK before importing the new. Anyway, here's the updated demo scene in a package.

    About the TwistRelaxer parameters, there is info about each one in the tooltips when you hover the mouse over them. But to give you more context:

    The "Weight" parameter of TwistRelaxer and also other weight parameters you find in all the FIK components is mainly used for smoothly enabling/disabling the solver. So instead of just disabling the solver, causing the pose to snap in the next frame, you can blend weight to 0 over time, giving you a smooth transition. 0 Weight means the solver does nothing, 1 means it is fully enabled and 0.5 is a half way blend between the two.

    "Parent Child Crossfade" cross-fades between two states. 0 Means the twist angle of the twist solver's transform will be locked to it's parent, so for example a forearm roll bone would twist along with the forearm bone. Value of 1 means it will be locked to the child, locking a forearm roll bone twist angle to the hand bone's twist angle. 0.5 would be a half blend between the two, like this: twistAngle = Mathf.LerpAngle(parentTwistAngle, childTwistAngle, 0.5f);

    "Twist Angle Offset" is angular offset around the twist axis in degrees. Will be applied on top of all calculations so you could use it to fine-tune the twist angle.

    When you play a cutscene from the middle, the character will be at some arbitrary pose due to animation, not it's default initial pose. So the IK is initiated differently, the pose of the character at initiation time does matter and change the results of the IK as it needs to sample the initial pose to find out which way to bend the limbs and how the bones are oriented and all that. That is exactly why all that default pose stuff is used by EditorIK.
    I'm not exactly sure how Slate works, haven't used it myself, but as far as Final IK is concerned, you'll just need to make sure the pose of the character is exactly the same every time you initiate the solver.

    Best,
    Pärtel
     
  37. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Just adding Editor IK with defeult pose defined didnt helped with problem You described, When cutscene played in the middle then positions are different, So we jsut need to play cutscene from start, or always restart position to defeult before animation? using Editor IK API?
     
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    You could try using EditorIKPose like EditorIK.cs does. Declare a public EditorIKPose defaultPose;
    Then call defaultPose.Store(bones) to store the default pose and defaultPose.Restore(bones) to put the character in that default pose before you play the cutscene. "Bones" are just ik.transform.GetComponentsInChildren<Transform>();

    You'll also have to call EditorUtility.SetDirty(defaultPose) after you call defaultPose.Store() for the SerializedObject to be properly serialized. Don't need an Editor script for that, can just use #if UNITY_EDITOR.
     
  39. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    743
    Hi @Partel-Lang. I think my last question might have fallen through the cracks, so here it is again... :)

    In the future when I update Final IK via the asset store, will it break anything with the ToeGrounder script? Or will you include it in Final IK itself?
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Oh, sorry... no, the changes I made to Grounder for that to work will be added to the future versions. Not sure if I'll add in the ToeGrounder itself, haven't tested it much, will have to find some characters with large toes, lol. Don't drag it into the FIK folder in case you delete it the next time you update the package.
     
  41. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    743
    Okay, thanks. So far it works great!!
     
    Partel-Lang likes this.
  42. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @Partel-Lang WE have a problem with Final IK + skinned mesh particle emitter, Our character emits particle during animation, And overall when Using Animator + character + FBIK , we just us hero body as emit source, The problem is that when using FBIK script particle dont emit from character actual animation position, but always from that humanoid embrional standard position. In earlier version we fixed that problem disabling "Fix transforms" but after update to newer actual version also with disabled that option, there is problem with particle emmision. Did You changed somerhing there? or have any idea how we could fix that problem?


    Below is a script that we use in cutscene for Fina Ik updating
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. namespace Slate.ActionClips.FinalIK
    6. {
    7.  
    8.     [Category("Final IK")]
    9.     public class AnimateFBIKBody : AnimateIKBase<FullBodyBipedIK>
    10.     {
    11.  
    12.         [AnimatableParameter(0, 1)]
    13.         public float weight = 1;
    14.         public TransformRefPosition IKTarget;
    15.  
    16.         [AnimatableParameter(link = "IKTarget")]
    17.         [ShowTrajectory]
    18.         [PositionHandle]
    19.         public Vector3 targetPosition {
    20.             get { return IKTarget.value; }
    21.             set { IKTarget.value = value; }
    22.         }
    23.  
    24.         public override string info {
    25.             get { return "Animate FBIK Body"; }
    26.         }
    27.  
    28.         protected override void OnAfterValidate() {
    29.             SetParameterEnabled("targetPosition", IKTarget.useAnimation);
    30.         }
    31.  
    32.         protected override void OnCreate() {
    33.             if ( isValid ) {
    34.                 var effector = actor.solver.bodyEffector;
    35.                 if ( effector.bone != null ) {
    36.                     targetPosition = InverseTransformPosition(effector.bone.position, IKTarget.space);
    37.                     return;
    38.                 }
    39.             }
    40.  
    41.             targetPosition = InverseTransformPosition(parent.actor.transform.position, IKTarget.space);
    42.         }
    43.  
    44.         protected override void OnRootUpdated(float time, float previousTime){
    45.             actor.solver.Update();
    46.         }
    47.  
    48.         protected override void OnUpdate(float time) {
    49.             var effector = actor.solver.bodyEffector;
    50.             var finalWeight = weight * GetClipWeight(time);
    51.             effector.target = IKTarget.transform;
    52.             effector.position = TransformPosition(IKTarget.value, IKTarget.space);
    53.             effector.positionWeight = finalWeight;
    54.             // actor.solver.Update();
    55.         }
    56.     }
    57. }
     
    Last edited: Dec 22, 2020
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    No, I didn't change anything about the update order or Fix Transforms, so not sure how updating FIK could have changed it. Actually I can't see how it could have worked like you described also before the update. The problem is that ParticleSystem is updated at some point after Update() and animation and before LateUpdate. FIK components normally update in LateUpdate so whatever changes are applied by the IK are ignored by the particle system. "Fix Transforms" puts the character to it's default pose in each Update.

    You'll have to simulate the particle system after the IK is updated:

    Code (CSharp):
    1. public IK ik;
    2.     public ParticleSystem p;
    3.  
    4.     private void Start()
    5.     {
    6.         ik.GetIKSolver().OnPostUpdate += OnPostUpdate;
    7.     }
    8.  
    9.     private void OnPostUpdate()
    10.     {
    11.         if (!enabled) return;
    12.         p.Simulate(Time.deltaTime, true, false);
    13.     }
    Best,
    Pärtel
     
    hopeful likes this.
  44. lordsamain

    lordsamain

    Joined:
    Jun 17, 2018
    Posts:
    12
    Hi @Partel-Lang :)

    I use VRIK and would like to know the best way to change the position of a solver. For example, if I want my left foot to follow the movement of my left hand. I was successful using solver.AddPositionOffset but I wanted to know if I could do it directly using the solver.

    Thank you!
     
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    You should be able to just parent the foot target to the hand controller.

    Best,
    Pärtel
     
  46. Jonathan-FourFats

    Jonathan-FourFats

    Joined:
    Apr 21, 2016
    Posts:
    18
    Hi @Partel-Lang ,

    I use CCD IK and would like to know how to set a contact angle.

    I have already set the rotation Limit Hinge, that works, but I would like to set an angle on the final bone to contact point.

    it's a robot arm, it have 5 bones, think scraping a round surface.

    How to set a target angle of 45", pointing up

    Thanks,
    Jonathan
     
    Last edited: Jan 5, 2021
  47. Aezoc

    Aezoc

    Joined:
    Jan 19, 2020
    Posts:
    6
    Hi @Partel-Lang

    I have a newbie question regarding FBBIK. I am using hand effectors for position and rotation and I would like to limit the amount of rotation that the hand effector confers to the forearm and upper arm bones. I am also using a single rig and set of animations for multiple characters, and adding modifiers so that characters move differently from one another. I think I would prefer to use bend goals for this task so that I can easily modify them per-character as well (so one character walks with elbows out more, etc). Is there a solver that I can use to compute a natural bend direction and then layer modifiers on top of it, or is there some other way I should approach this?

    Thank you!
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    There is no solver that could do both target position and rotation in Final IK. Robotics solvers like that are just too slow to be used on game characters, which is why I haven't made the effort to add them in. Also, Unity will hopefully soon add support for inverse dynamics to their Articulated Bodies, which will make it possible to solve robotic arms.
    I do have a couple of possible solutions for you though.

    This "Industrial Robots" package of a custom solver I made for KUKA and UR5 rigs.

    This package shows you how you can set up PhysX parameters to turn the normal physics engine into something like an inverse dynamics solver. Basically set your rig up like a ragdoll, so that means you also get to use collisions and joint limits.

    Hey,
    I don't have an independent bend direction solver, I mean there is something built into FBBIK, which is what you see when you set Rotation Weight to 1, but not anything that could work on it's own. Bend direction of the elbow is the most difficult problem to solve with IK, there is no analytic way to manage it, there is no one single correct solution for a given hand target position/rotation.

    If an FBBIK arm bends too much/wrong with effector rotation weight set to 1, I suggest you leave it at 0, set "Maintain Hand Rot" to 0 and instead of leftHandEffector.rotation = x, write leftHandEffector.bone.rotation = x; That is what I normally do and it looks good enough in most cases.

    Best,
    Pärtel
     
  49. Futwerk

    Futwerk

    Joined:
    Jun 21, 2020
    Posts:
    6
    Hi @Partel-Lang
    I've been experimenting with combining Aim Controller and Aim Boxing in a custom script, and found I can get it to work well by using Aim Controller as the base and adding:
    Code (CSharp):
    1. if (pin != null) ik.solver.transform.LookAt(pin.position);
    to the start of LateUpdate, and setting pivotOffsetFromRoot to 0, 0, 0.

    This makes me wonder: what does "pivot" do in Aim Controller? And if my solution makes it obsolete for my purposes, can I safely remove it and references to it without breaking some functionality?

    Thanks so much, your plugins and support are amazing,
    Futa
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,242
    Hey,
    The pivot is used for rotating the aiming direction vector. So for example if in one frame your target was in front of you and in the next you switched it to a target behind you, aiming direction would be smoothly rotated around the pivot instead of interpolating the target position straight from A-B, which would cause the character to aim at itself in the middle at one point.

    But you shouldn't have to be adding in that line, just enable "Use Animated Aim Direction" in AimController. Then adjust "Animated Aim Direction" if necessary, it does the same thing basically, just without the pin, using a direction vector instead.

    Best,
    Pärtel
     
unityunity