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

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    114
    Is it possible to stretch the arms of a Full Body IK if the hand target gets too far away? for a cartoony effect
     
  2. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi Partel,
    I wrote a little posing system for Final Ik to tween between various poses and I'm using goals that are child of the character itself.
    I noticed now that Final IK override the goals position with a world position at every update, so If I have some script moving the parent object the goals will all stay in place.
    Any reason you are doing this? Or it's just a bug?

    I just have a full body biped IK component active, and all the goals are overwritten.
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi!
    There's a snipped in the package for the rotation question..

    Code (CSharp):
    1. // Rotating the root of the character if it is past maxAngle from the camera forward
    2.         void Rotate(Vector3 forward, float maxAngle) {
    3.             if (maxAngle >= 180f) return;
    4.            
    5.             // Get camera forward in the character's rotation space
    6.             Vector3 forwardLocal = transform.InverseTransformDirection(forward);
    7.            
    8.             // Get the angle of the camera forward relative to the character forward
    9.             float angle = Mathf.Atan2(forwardLocal.x, forwardLocal.z) * Mathf.Rad2Deg;
    10.            
    11.             // Making sure the angle does not exceed maxangle
    12.             if (Mathf.Abs(angle) > Mathf.Abs(maxAngle)) {
    13.                 float a = angle - maxAngle;
    14.                 if (angle < 0f) a = angle + maxAngle;
    15.                 transform.rotation = Quaternion.AngleAxis(a, transform.up) * transform.rotation;
    16.             }
    17.         }
    For movement it is easiest to use an 8-direction strafing animator controller. See the "Aiming" demo in the package (_DEMOS/Virtual Reality).

    Hi! Yes, it is easiest to just multiply the localPosition of the forearm/hand bones in LateUpdate():

    Code (CSharp):
    1. void LateUpdate() {
    2.             forearm.localPosition *= armStretchMultiplier;
    3.             hand.localPosition *= armStretchMultiplier;
    4.         }
    5.        
    6.        
    Hi!

    Thats weird... Were you talking about the bend goals? There shouldn't be anything overwriting them, for example in the Driving demo there are goals and you can move them as you wish and they'll stay where you put them.
    The goals aren't parented to any of the bones of the character, are they? That would be a circular dependency issue.

    Cheers,
    Pärtel
     
  4. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Normal effector targets, I got used to call all goals including bend goals since I unified them in my scripts.
    Anyway I tried the samples and went back to my scene and it's working now...
    So either it's some Unity bug, or it's some obscure bug only appearing in certain conditions.
    Either that or I changed something, but I don't remember doing anything. I'll let you know if it reappears.
    The goals are all child of the root bone(parent of the hip bone), could this cause issues?
    I designed them as child of the root, so I can animate them in the Maya and export as a normal bone if needed(didn't need it yet, so it's untested).
     
  5. ZenUnity

    ZenUnity

    Joined:
    Apr 21, 2013
    Posts:
    28
    Hi Pärtel,

    Really excited about using this with VR! Do you have an estimated time when you'll release an early version of VRIK?
     
  6. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    Between your VR aiming demo, and the code you posted above i'm almost to where I want to be.

    If I use the AimIK aim weapon demo, and I set my vr target i'm aiming at as my controller my gun aims correctly, but the character animations thrown off my character.

    In the vr demo with the above script everything but the weapon aiming is good.

    I'm not sure how to merge the 2 together. Did I describe my issue well enough you could point me in the right direction? Thanks for the previous reply :)
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi,
    As the goals come from Maya, its probably that they have animation curves in the animation and the Animator keeps them fixed to that.

    Hi,
    Not yet, sorry, but its not very far anymore.

    Hi, sorry, didn't quite understand, what did you mean by "but the character animations thrown off my character."?

    Cheers,
    Pärtel
     
  8. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    AimIK moves not only the weapon, but the head as well. so when I mix the VR Aiming demo with GoogleVR and the rotation script the character moves properly, but when I add aim IK to the weapon can aim independantly, that conflicts with the head behavior that was previously working. I want to be able to use just the weapon aiming part from AimIK, without affecting the head.
     
  9. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    Another way to explain what i'm trying to get is this:
    Starting with the AimIK demo, I import GoogleVR and use it to control head rotation, and rotate the body when it gets outside the set limits, so we never are looking sideways. When the body rotates move the target we are aiming at in front of us.

    With that working i'll be able to replace the target with and opencv AR tracked marker the device camera can see, and have a 3d tracked controller controlling where I'm aiming.

    I have the AR part working when I attach it to the AimIK demo, but once I start trying to get it working with Google VR thats what I can't get to work so far.

    I think AimIK is the better starting base, as after playing with the VR aiming demo the way the gun behaves isn't what i'm looking for, as I want to be able to controller what the gun is aiming at, not the gun postion.
     
  10. moddyb

    moddyb

    Joined:
    May 16, 2013
    Posts:
    3
    Hello, I am currently working on a system that takes joint rotations as input and needs a humanoid making the pose defined by those angles. However I do not have any position data. So when the model is crouching, the feet go up instead of the hips going down. Would using the Final IK help me fix this? Thanks..
     
  11. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi Partel,
    How come the global weight of FullBodyBipedIK is called IKPositionWeight?
    It took me a while to find it, since in the editor it's simply weight and also in the docs.
    Also the name suggest it's only affecting position, but it's also controlling rotation.
     
  12. beNice

    beNice

    Joined:
    Sep 12, 2014
    Posts:
    28
    Hey, Partel.

    The "Hit" Action (and possibly others) for PlayMaker no longer seems to work with the latest PlayMaker build.

    It may have something to do with this -- from the PlayMaker release notes (https://hutonggames.fogbugz.com/default.asp?W311):
    It will work in playmode if you reset the component in playmode but it won't work until you reset them, and only in playmode.

    Thank you!
     
  13. Partel-Lang

    Partel-Lang

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

    You'll probably just need to solve AimIK before FBBIK and all the other stuff. Disable the component at start and call aimIK.solver.Update before the other IK components.

    Hi!

    No I don't think I have a solution for you, sorry. I think the problem is similar to the Perception Neuron mocap tech, where they use only inertial sensors and no positional tracking. I think they made it work with some clever foot planting, I mean when they detect a foot planted, they'll move the entire body relative to that point. But it will still lose it when you try to jump from one place to another.

    Its mostly historic reasons and inheritance. It extends IKSolver which has both IKPositionWeight and IKRotationWeight, so for the solver that does not have any meaningful rotation weight, IKPositionWeight is used as the master weight. I should probably add IKSolver.weight getter/setter or something..

    Hey, thanks for the heads-up, I'll take a look..

    Cheers,
    Pärtel
     
  14. ilja

    ilja

    Joined:
    Jan 23, 2013
    Posts:
    5
    Hi folks,

    I wonder if I can use the final IK Fullbody Biped but add extra bones and effectors to it.
    I know I could create a full custom rig from scratch but my character is 99% humaniid biped and I just need to bind a few additional effectors to the rig perfectly created by FBBIK component.

    Also I dont want to loose the ability to use other FinalIK components that reply on FBBIKcomponent by disposing it and creating e.g. a custom CCDIK rig.

    To clarify....my humanoid biped character has wings which i want to control by effectors.

    Many thanks in advance.
     
  15. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    Just curious, will VRIK be a new plugin, or will it be bundled with FBIK?
    Cheers,
     
  16. Partel-Lang

    Partel-Lang

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

    You cant add efectors just like that, but you can solve other solvers on top of FBBIK to take care of any extra limbs or wings. Here's an example. If you had a character with 4 arms, you could choose the dominant pair and assign them as FBBIK arms, then solve the other arms with say LimbIK.

    It will be bundled with Final-IK, thats why I call it "Final" :)

    Cheers,
    Pärtel
     
    popupAsylum and seansteezy like this.
  17. funderburk5

    funderburk5

    Joined:
    Nov 25, 2014
    Posts:
    9
    I saw your video on advanced character physics and was wondering how you managed to make the character stagger and catch themselves upon falling and what i could do to possibly replicate the same effect. Also,

    What procedures do you use to calculate the velocity and how does it determine where to take the next step? Are you using joint actuators to simulate torque? How do you define the targets state? in regards to velocity and position? Looking forward to hearing back from you.
     
  18. Partel-Lang

    Partel-Lang

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

    You must be looking for PuppetMaster, not Final-IK.
    It doesn't have a stagger behaviour yet, but I'll be working on that in the future. PM is using ConfigurableJoints to simulate the muscles.
    Please also try this demo.
     
    funderburk5 likes this.
  19. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    when using FinalIK with Vive or Tango, wwhen using FinalIK with Vive or Tango, when I want to move a character around based on player movement, what effector should I be using, and parented to what part of the skeleton, so I can have an idling character, 'walk' to where the player is?
     
  20. funderburk5

    funderburk5

    Joined:
    Nov 25, 2014
    Posts:
    9
    I'm trying to create a gyro stabilized camera for my full body awareness, first person biped character using Look at IK. The main camera is attached to the head of the humanoid, as the head moves/rotates the camera is stabilized to keep the view from becoming disorienting from head bob caused from various animations. How would i go about doing that?
     
  21. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi Partel, have you had a thought at writing a bone based cloth system?
    With your knowledge of math it should be easy and I'm sure you will release another gem.
    I wrote one myself, but my math is not good and it's jerking when there is several colliders near each other pushing in opposite directions with long enclosing cloths like gowns or capes so I had to limit myself to short clothes.
     
  22. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Really basic question but here it goes...

    How can I change the Weight value of Look At IK from another script? I'm trying to make the character look at the player (which works) but not all the time. So I need to randomly change the Weight value from 0 to 1 and back from time to time via script.
     
  23. Partel-Lang

    Partel-Lang

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

    You should use the head effector (see the "Head Effector" demo). You can move the character simply by moving the character to follow the HMD. You could make an 8-direction strafing animator controller to move it like in the "Aiming" demo.

    All I can think of would be to use the head effector to fix the head. But you might find that stabilizing only the rotation of the camera would be enough. If you locked the position too, you'll probably get unnatural motion as nobody walks with their head completely still. I think you shouldn't use IK to control the rotation of the camera, but mouse or what ever input you'd normally use, then use IK to match the body to that rotation. If the camera is parented to the head, just rotate the camera back to how it was after IK has solved.

    What exactly do you mean by a bone based cloth system? The Cloth in Unity works on a SkinnedMeshRenderer, so you can still use bones with it. You can adjust how much physics is used for a vertex by setting its max distance. Or did you mean something else?

    lookAt.solver.IKPositionWeight = something;

    Cheers,
    Pärtel
     
    funderburk5 likes this.
  24. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    I meant something alternative to Unity built in system. Unity clothing is quite heavy as it does its calculation per vertex, I was talking of having a cloth driven entirely by bones/joints only.
    Something like this:
    https://laboratoriesx86.wordpress.com/2014/07/27/joint-based-hair-cloth-physics-for-unity/
     
  25. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Oh I see... I'm afraid 2 plugins is all I can support at the moment, so I won't be making any new ones any time soon, sorry.
     
    chelnok and 00christian00 like this.
  27. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Partel-Lang and 00christian00 like this.
  28. funderburk5

    funderburk5

    Joined:
    Nov 25, 2014
    Posts:
    9
    Hey Partel thanks for your help so far! I ran into an error message upon importing the Final Ik integration with puppet master.

    Assets/Plugins/RootMotion/PuppetMaster/_Integration/Final-IK/Behaviours/Biped/BehaviourBipedBalanceFBBIK.cs(53,38): error CS1061: Type `RootMotion.Dynamics.PuppetMaster' does not contain a definition for `broadcastCollisions' and no extension method `broadcastCollisions' of type `RootMotion.Dynamics.PuppetMaster' could be found (are you missing a using directive or an assembly reference?)

    I'm very new to programming so I wouldn't even know how to fix this error and would appreciate your help yet again. Looking forward to your reply.

     
  29. Partel-Lang

    Partel-Lang

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

    Yeah that was a mistake I made with the initial 0.4, I have uploaded a fixed version to the store.
    Download the latest from the store or just delete the line that is causing the error, it is not used anymore.

    Cheers,
    Pärtel
     
    funderburk5 likes this.
  30. bulisor

    bulisor

    Joined:
    Feb 12, 2016
    Posts:
    7
    Hi guys. I have another little problem, and I don't know how to solve it. Let me explain.
    I have a customizable character(I can change clothes on it). So I have a rigged character, and the clothes are rigged too, and if I apply FINAL IK on character, it not effect clothes too. So the question is: I have to apply FINAL IK on clothes and on character in the same time? Or it's not ok, and there should be another method for clothes. Thanks a lot, and sorry my english;)
     
    UnnamedGameDev likes this.
  31. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi!
    I have a problem : during attack animation left palm positions changes and 2 handed axe handles only by right arm.
    And i'am trying target left hand like in carry box example. But during the impact hand turns in unnatural way. May be i can somehow solve it?
    1.png 2.png 3.png 4.png
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Thank goodness we're back to the old forums.
    If anyone had their question unanswered in this mess or PMs unresponded, please just ask again.

    Best,
    Pärtel
     
  33. kriket

    kriket

    Joined:
    Aug 28, 2014
    Posts:
    33
    Recently started using Final-IK but I can't see those solver blue-balls in the scene view. Here is what I did. Opened a brand new scene. Added dummy mesh to the scene. Then added FBBIK script. It didnt recognize any reference bones (even though it was the dummy provided in the package and already had the avatar on it) so I had to add them manually. It didnt have a animation controller on it, so i added Humanoid_idle controller to it.

    But I still can not see any of those blue spheres (connecting other blue spheres with thin lines) like you have in the video.

    Whats wrong.
     
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, If there are no solver blue balls in the scene view when the FBBIK gameobject is selected, there must be something wrong with the references. Is there a little warning box on the bottom of the component?
    Screen Shot 2016-07-12 at 13.27.07.png

    I'm a bit confused though, it has never ever failed to get references for the Dummy or other Humanoids.
    What happens if you right-click on the FBBIK component header and select "Auto-detect References"?
    Any warning messages from Final-IK in the Console?

    Cheers,
    Pärtel
     
  35. kriket

    kriket

    Joined:
    Aug 28, 2014
    Posts:
    33
    Hi Partel. selecting "Auto-detect References" gets the necessary info. To test this further, I deleted the FBBIK component completely and added a new one. It didnt recognise anything to start with. But selecting "Auto-detect References" again meant it did. So at least thats ok.

    The bigger problem is that I still do not see any blue spheres on the dummy in scene view. If you want i can package it up and email it to you. Or else I can continue posting screenshots here
     

    Attached Files:

  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, are you sure you have not accidentally deleted Plugins/Editor/RootMotion/FinalIK, because that is not what the custom editor for FBBIK looks like.
    Please make a backup, open an empty scene, delete Plugins/Editor/RootMotion and Plugins/RootMotion and reimport the package.
     
    kriket likes this.
  37. kriket

    kriket

    Joined:
    Aug 28, 2014
    Posts:
    33
    Yup, srry, that was it. Sorry :)
     
    Partel-Lang likes this.
  38. kriket

    kriket

    Joined:
    Aug 28, 2014
    Posts:
    33
    Hi again Partel. I was trying the experimental Balance scene from puppetmaster but encountered the error below. check screenshot.
    Please help. Thanks.
     

    Attached Files:

  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    Looks like something has gone missing again. Could you delete the "PuppetMaster/_Integration/Final-IK folder" and try reimporting the integration package?
     
  40. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi Pärtel,
    Would it be ok to ask you for some help?
    I am using the interaction system, it works to a certain extent but I am not able to speed up my arm movement , I looked at the docs http://www.root-motion.com/finalikdox/html/page10.html , see that speed variable, I changed to that to 4 but does not seem to make a difference. Is there something else I could/should do to speed up the interaction system?

    Also my interaction system "arm animation" only seems to work well if I am facing a certain direction, is this possibly related to the element type (Position weight)? The interaction system target is always in front of the human mesh so I am not sure why this does not work so well.
    Any advice would be much appreciated.
     
  41. Partel-Lang

    Partel-Lang

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

    The speed variable is not working? How can I reproduce this? (if I go to the "Interaction" demo scene, it seems to work fine). Which Final-IK version do you have? You can find it in Plugins/RootMotion/FinalIK/FinalIK ReadMe.txt.
    You could also make the InteractionObject weight curves shorter to speed things up.

    What exactly is not working well with the arm interaction? A video or perhaps you could zip me that project?

    Cheers,
    Pärtel
     
  42. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Thank you for your reply, It probably is working well but I just don't know how to use your product correctly :)
    Would it be ok for me to send you a private msg or start a unity forum conversation with you, I don't want to show too much of my game .
     
  43. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi Pärtel,
    Update: So I think I am getting a bit closer to the reason to my issue.
    I noticed that on my full body biped IK script that I had set the weight slider to 0, see screenshot of setting I mean:
    1.PNG
    (as if I set to 1 then my bodies arms do not work correctly, they face backwards and running animations are messed up), see screenshot:
    2.png
    , the weight slider being set to 0 is causing the interaction script to not move or misbehave, the weight slider on the body ik script seems to ned to be set to 1 but is causing this other issue.. now I suppose the issue I have is why my body's arms face backwards if setting this weight slider to 1?

    I am trying to solve this by changing the weight attribute via script for a short while while the interaction is running, my code I using is:

    public FullBodyBipedIK ik {
    get {
    return fullBody;
    }
    }

    [Tooltip("Reference to the FBBIK component.")]
    [SerializeField] FullBodyBipedIK fullBody; // Reference to the FBBIK component.

    void Start(){
    fullBody = GetComponent<FullBodyBipedIK>();
    }

    Then I try to set:
    fullBody.Weight = 1;

    But weight is not found.
    Should it be:
    fullBody.solver.SetIKPositionWeight = 1;

    Can I ask you to provide some insights to this?
    Apologies for the mix of help requests, your amazing asset is has many features which I need to grips with :)
    Hope you would not mind providing some advice on the above.
     
    Last edited: Jul 16, 2016
  44. funderburk5

    funderburk5

    Joined:
    Nov 25, 2014
    Posts:
    9
    Hey Partel! Got another question in regards to fps aiming. I added offset effector component to test out an idea i had and as i was offsetting the body along the Y axis, whenever I aim the gun and the sight picture of the gun went out of focus and i was wondering what could i do to keep the sights of the gun relative to the camera despite the influence of offsetting the body. I tried to set the hands maintain relative position property to 1 but to no avail. Looking forward to your response :)


    Before offset:
    -Normal Sight picture




    After offset
    -skewed sight picture

     
    Last edited: Jul 16, 2016
  45. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    HJi Pärtel,
    I have managed to sort out my issues, not really anything to do with your awesome asset :) One of my animations was causing weird behaviour while interaction was happening, and I managed to script what I wanted , cool runnings :)
     
  46. Heckmouse

    Heckmouse

    Joined:
    Nov 7, 2014
    Posts:
    27
    Hi Partel! I just bought Final IK. I found a few responses regarding stretchy IK, but I haven't found any code to make the stretch happen automatically. I'd like the IK joints to automatically stretch to fit to the IK goal. Is there a way to do that?

    I'm using LimbIK at the moment. Here's the post I'm referencing:

     
  47. Heckmouse

    Heckmouse

    Joined:
    Nov 7, 2014
    Posts:
    27

    Nevermind...That was silly.
    Code (CSharp):
    1.  
    2. stretchMultiplier = Vector3.Distance(ikTarget.position, shoulder.position) / (shoulderToElbowDistance + elbowToWristDistance);
     
    Partel-Lang likes this.
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, glad you got it sorted.. The arm problem is probably because the arms are sampled wrong, see this tutorial for more in depth information. Basically all the limbs need to be bent slightly in their natural bending directions in the Editor, they must not be completely (mathematically) straight or inverted.
     
  49. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Ok thanks, my rig seems to have all blue, no yellow or red markers. but will work on it more, see what the mistake is. Thanks again for your assistance!
     
  50. funderburk5

    funderburk5

    Joined:
    Nov 25, 2014
    Posts:
    9