dalezhao / ik.js

Dale's Inverse Kinematics (IK) solver in JavaScript.
9 stars 1 forks source link

Working example? #1

Open WebRTCGame opened 11 years ago

WebRTCGame commented 11 years ago

It would be very useful to have a working 2D and a working 3D example. 2 Bone reaching, 3 bone reaching, constrained length, constrained rotation, etc. Please and thank you.

dalezhao commented 11 years ago

Hi there,

Thanks for looking at this code repository! Currently one of the working examples can be found on top of my home page: http://dalezhao.com/about_me.php. Relevant setup is in splash.js - the last <script> included on that page. (The visualization utilizes my canvas animation library flipbook.js, which I have not put on GitHub yet.)

This project is still at its initial stage and I will commit sample code soon. Currently it only supports one DoF per joint, i.e. rotation around a fixed axis, and works only in 2D. But since the code solving the IK equation is generic (please refer to Node.stepIK(pos, dt), Line 212 - 267 of ik.js in this version), more DoFs can be readily put into the Jacobians for other joint types in both 2D and 3D contexts (e.g. prismatic/cylindrical joints, etc.). I will add those features in coming versions.

Thank you for your advice!

Best, Dale