Search Unity

Free Inverse Kinematics script!

Discussion in 'Assets and Asset Store' started by dogzerx2, Aug 31, 2011.

  1. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    Sup guys! Some people have been asking me for the ik script I did for the soldier on my signature, so I released it for free at the asset store, enjoy!

    TUTORIAL READY!
    (needs the latest version of the script, so re-download please!)
    http://u3d.as/content/dogzer/inverse-kinematics/2fP

    tutorial:




    To use it on your character you could just match the rotation of the character arm's bones with the ik arm. And if the bones aren't aligned with the ik arm, then create children on the ik arm upper arm forearm, match the bone's rotation to those, and then rotate those children until the bones are aligned correctly!

    I might make a tutorial soon!
     
    Last edited: Sep 2, 2011
    omnivore, hirok and TerraUnity like this.
  2. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Awesome! Thanks =)
     
  3. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    You are very kind, thank you!
     
  4. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Thanks, please, make the tutorial.

    Por cierto me encanta como se mueve el soldado.
    Un saludo.
    I hope you speak spanish. :)
     
    Last edited: Sep 1, 2011
  5. defjr

    defjr

    Joined:
    Apr 27, 2009
    Posts:
    436
    Excellent share, thanks so much!
     
  6. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Fantastic !

    Thanks a lot.

    6R
     
  7. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    Hey!

    I'm doing some fixes to the script!!

    After that, I'll upload a little tutorial. It should be really easy to implement the IK to any character!
     
  8. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    Guys! Check out the tutorial! You'll see it's really easy to use now:

     
  9. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    AWESOME, thank you so much!
     
  10. smh1988

    smh1988

    Joined:
    Jun 8, 2011
    Posts:
    3
    very good and useful .
     
  11. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    thank you !!
     
  12. TheSin

    TheSin

    Joined:
    Aug 4, 2011
    Posts:
    150
    This is excellent, thankyou very much :)
     
  13. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    That's a really impressive script!
     
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Oh, thanks a lot. Great script!!
     
  15. dexxi

    dexxi

    Joined:
    Aug 8, 2012
    Posts:
    1
    Inverse Kinematics script is fantastic, thanks so much for this script dogzerx2!

    It works great on character arms, but is there a way to make it work on legs as well?

    Right now it kind of works, but it rotates the leg 180 degrees, I think "elbowTarget" should be calculated differently for the leg :(
     
  16. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
  17. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Thank you for providing this script :)
     
  18. TheEpicWhiteFox

    TheEpicWhiteFox

    Joined:
    Nov 25, 2012
    Posts:
    1
    Thanks dude you are a life saver :D
     
  19. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,440


    This is what I'm getting, too. It appears that my character's upperarm and forearm have a local Z that points behind the character, and the thigh and shin local Z point forward. The thigh and shin immediately wants to turn out instead of orient toward the targets.
     
  20. dustyh55

    dustyh55

    Joined:
    Dec 10, 2013
    Posts:
    3
    For me it seems to think the elbow naturally bends outward. Have no idea why, I've tried rotating the bones in blender 90 degrees and basically anything i can think of and yet it always makes the outside of the elbow rotate towards the elbow target instead of the back of the elbow (like how humans do it).

    After testing with various other models, it does the same thing. Great script, very useful and easy to use, but broken at the moment and I have no idea how to fix this seemingly trivial problem that could be solved easily by the one who made it. Very disappointing.
     
    Last edited: Dec 12, 2013
  21. VastoLorde

    VastoLorde

    Joined:
    Sep 1, 2013
    Posts:
    1
    great script!
    Thanks!
     
  22. HASH280689

    HASH280689

    Joined:
    Feb 26, 2014
    Posts:
    3
    Hi Dogzerx2. I've been using your script for IK. It works like a charm. I'm having some difficulty however. If I parent my character to a game object which is rotating on the Y-axis, it messes up. It's like the limb is locked into looking staight forward if that makes sense. If I parent the game object with the IK Limb scrip to ANY OTHER GAMEOBJECT, my character begins to contort. I can only conclude that these is something that is stopping the IK Limb from properly inheritting the proper rotation. I could do with some help on this.

    Thanks ;)
     
  23. Steviebops

    Steviebops

    Joined:
    Apr 9, 2013
    Posts:
    132
    I'm also having a problem, my upper arm gets some really weird rotation, almost 180 on the axis running from the elbow to the shoulder.
     
  24. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,254
  25. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    Nice! I'm very glad you found it useful.

    Btw the Terraland Tournament looks awesome, it's like a small AAA game. Amazing way to show off your landscape products.

    Someone should really use your products to make a flight simulator!
     
    TerraUnity likes this.
  26. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,254
    Thanks for your kind words and support, we really appreciate this. Building a flight simulator was our day 1 goal and we start making it when our tough schedule lets us to do so :)
     
    dogzerx2 likes this.
  27. tathoi93

    tathoi93

    Joined:
    Mar 22, 2016
    Posts:
    1
    Hello @dogzerx2,

    Your IK script really is a life saver! I have used it on an university project of mine and it works out perfectly.
    But I need to set a limitation of movement and rotation of the arm of a model, otherwise the arm would be able to bend unnaturally, like into the model's body for example.
    Do you happen to know ways to edit your script, so that the arm would have limitations on movements and rotations?

    I am a student currently studying in Germany and am new to Unity.
    Thank you for your time.
    (a picture of an example of the movement limitations is attached for reference)
     

    Attached Files:

  28. Daro8590

    Daro8590

    Joined:
    Jan 26, 2015
    Posts:
    7
    Hey man! I lost over 2 weeks dealing with OnAnimatorIK of Unity and it looks like there is no light at the end of that tunnel. So i found your solution on store and man,. belive me that tunnel now is a blue sky! Thanks! ;)
    I would ask you if I can i modify it to a c# version to use it on my project! Of course credits are for you!
     
    dogzerx2 likes this.
  29. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    Updated script!!

    Now there's no re-parenting, nor instantiating gameobjects, or anything silly. And script is much shorter too.

    Though there's no transition feature yet. But that's easy to do. I might add two scripts, with and without transition. So you can choose to transition between animation and IK ... or use the one without transition with slightly better performance.

    Link:
    https://assetstore.unity.com/packages/tools/user-tools/animation/inverse-kinematics-1829
     
    Alverik likes this.
  30. arunavanag

    arunavanag

    Joined:
    Oct 10, 2017
    Posts:
    15
    I am trying to implement this on a robot manipulator, and it messes up all the joints and throws things 180 degree apart. Is it only restricted to arms. My manipulator is 6 dof @dogzerx2
     
  31. joostbos

    joostbos

    Joined:
    Feb 4, 2015
    Posts:
    64
    @dogzerx2 I sent you a mail with my question, but maybe you missed it. Hope you can react in this forum.

    First of all, thanks a lot for your Inverse Kinematics script. It’s great to be able to control the elbow more accurately than with the Vive IK script.

    It works with the Vive controller as hand target and a Vive tracker as elbow, but what I can not find in your video or in this thread is how to determine the offset-rotations for upper-arm, fore-arm and hand. When I use your example scene with the Vive controller and the tracker the controller is perpendicular to the hand.

    In my own scene I will use this on a character that is in T-pose. Do you have a recommendation on how to set the offset-rotations in that case?

    Thanks!
     
  32. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    would this work for a quadruped?
     
  33. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    It should, but only basic cartoonish quadrupeds

    The limit is that limbs can have only 2 segments, basically regular human arms and legs

    You will have some problems if you want to animate horse legs
     
  34. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right so best not use this asset for my zebra ai :(
     
    dogzerx2 likes this.