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: https://jsantell.github.io/THREE.IK/

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 :slight_smile:

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