# IK algorithm for GLTF or GLB models

Hi friends, I found this example in BabylonJS, Link: https://www.babylonjs-playground.com/#4HTBYP#2, where if we move the pole target X, Y, Z of the white sphere above the head then the IK of humanlike leg is computed and displayed on the gltf model. I have been struggling to understand how to replicate this code in threeJS. Can someone please let me know if there is such an example in threeJS?

Have you tried this: THREE.IK - inverse kinematics for three.js

Related topic:

I am not sure how to apply that library to GLTF or GLB models. @Mugen87

Using this previous example, https://jsfiddle.net/9omhsep3/

if there were a cube somewhere in the scene, how can I make the arm point in the direction of the cube?

Is there a way to calculate the angle difference between the 3D cube position and 3D arm position of the character and then move the arm in that direction of the cube?

Visualizing is too hard in 3D and coding it, is even more difficult. Please help.

Although I know IK is available in BabylonJS, I would like to continue using ThreeJS. Thank you.

The format you use to import a model doesnâ€™t really matter here â€” once itâ€™s done loading, itâ€™s just a THREE.SkinnedMesh like any other. You can access the bones from there and manipulate them manually, or use libraries like THREE.IK.

I donâ€™t know of a tutorial that summarizes how to do IK in threejs, sorry, so you may want to start with something like THREE.IK and ask more specific questions as you run into issues.

thank you for your message @donmccurdy. Soldier.glb (2.1 MB)

I am having difficulty understanding how to create the IKChain for the arm. I really wish there was just one example that I can build off of that.

Does anybody have the experience of 3D inverse kinematics?

I believe Alex Goldring has developed one possible solution for his awesome game (check it out!!). He also links some resources in his Showcase Post

1 Like

Hey, i only have a 2-bone IK solver, it will work for any joint, like elbow or a knee, but itâ€™s not exactly a full IK solution, since it doesnâ€™t work with chains of more than 2 bones

Thank you to both of you Can I please see the code specifically for the IK?

never works