8000 GitHub - lo-th/fullik: javascript fast iterative solver for Inverse Kinematics
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lo-th/fullik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javascript fast iterative solver for Inverse Kinematics on three.js

is a conversion from java to Caliko libs, Caliko library is an implementation
of the FABRIK inverse kinematics algorithm by Dr. Andreas Aristidou

LAUNCH DEMO

Note: Fullik is now FIK
new Fullik.Bone() -> new FIK.Bone3D()
new Fullik.Bone() -> new FIK.Bone3D()
new Fullik.Chain() -> new FIK.Chain3D()
new Fullik.Structure() -> new FIK.Structure3D()

Usage

const { Structure3D } = require('FIK');
const scene = new THREE.Scene();

const solver = Structure3D(scene);

const n = {
     mesh : new THREE.Mesh( new THREE.SphereGeometry( 0.1, 6, 4 ),  new THREE.MeshStandardMaterial({color:0xFFFF00, wireframe:true }) ),
    control : new THREE.TransformControls( camera, renderer.domElement ),
}

function updateSolver() {
    solver.update();
}

scene.add(n.mesh);
scene.add(n.control);

n.control.addEventListener('change', updateSolver);

n.position = n.mesh.position; //  publishes x, y, z to the engine...

From Demo 2

var numChains = 3;
var rotStep = 360 / numChains;
var constraintAngleDegs = 45;
var color = 0xFF0000;

for (var i = 0; i < numChains; i++ ){

    switch (i){
        case 0: color = 0x550000;   break;
        case 1: color = 0x005500; break;
        case 2: color = 0x000055;  break;
    }

    var chain = new FIK.Chain3D( color )

    var startLoc = new FIK.V3(0, 0, -40);
    startLoc = FIK._Math.rotateYDegs( startLoc, rotStep * i );
    var endLoc = startLoc.clone();
    endLoc.z -= defaultBoneLength;

    var basebone = new FIK.Bone3D( startLoc, endLoc );
    chain.addBone( basebone );

    for (var j = 0; j < 7; j++) {

        chain.addConsecutiveRotorConstrainedBone( defaultBoneDirection, defaultBoneLength, constraintAngleDegs );

    };

    solver.add( chain, target, true );

}

About

javascript fast iterative solver for Inverse Kinematics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0