A downloadable custom node

A common question users of the Godot Engine ask, is how to do IK in 2D at runtime, instead of in the editor.

I am pleased to provide you with TWO custom nodes that can do this for you! Simply add the scripts to your project folder, both are simple .gd files with associated class_names.

The InverseKinematic node is a highly flexible and fully general solution, using cyclic coordinate descent. CCD is an iterative solution where you can trade precision for performance and visaversa.

The OneJointIK node, on the other hand, is a lightweight solution perfect for legs, arms, or other IK chains with only two bones. It uses trigonometry and will always be exactly precise.

KNOWN ISSUES:

Neither node correctly adapts to global scaling. I have been unable to fix this. If you absolutely need to scale something that uses one of my IK nodes, my suggested work-around is to use a viewport texture. (You do not need to do this for x-flipping. Support for that is special-cased.)

StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorEphemeralen
Made withGodot
Tags2D, inverse-kinematics, node

Download

Download
2DIK_Demo_Project.zip 11 kB
Download
InverseKinematic.gd 2 kB
Download
OneJointIK.gd 3 kB

Development log

Comments

Log in with itch.io to leave a comment.

I learned so much from looking at your code! Very useful. Thank you!

Awesome!! that is what I was looking for, however, I want to report one simple fix, when we scale the parent, the length of the child nodes becomes inaccurate in OneJointIK.gd. So, in order to fix this issue, simply multiply the length of both the lower and terminus (upper length and lower length) by their absolute global_scale.x in the reach_toward method.

(1 edit)

That was the first thing I tried. I tried a lot to get global scale to apply correctly. Because you're right, that should work. But I couldn't get it to work.

Great job! This was super useful for my future project! Thank you!

(+2)

Would you mind putting a license on this like with your tileset generator?