All Projects → jsantell → Three.ik

jsantell / Three.ik

Licence: mit
inverse kinematics for three.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Three.ik

g3d
Realtime WebGL rendering maps and big data visualizations based on MXFramework and Three.js.
Stars: ✭ 52 (-79.69%)
Mutual labels:  threejs
aleph
Aleph is a 3D object viewer and annotation/measurement tool built with A-Frame, AMI, StencilJS, and Ionic
Stars: ✭ 64 (-75%)
Mutual labels:  threejs
jump
低配版“跳一跳”,基于Three.js
Stars: ✭ 33 (-87.11%)
Mutual labels:  threejs
reaction-diffusion
WebGL reaction-diffusion system with variable anisotropic diffusion and Phong illumination.
Stars: ✭ 23 (-91.02%)
Mutual labels:  threejs
cuberun
A small 3D game built with react-three-fiber
Stars: ✭ 117 (-54.3%)
Mutual labels:  threejs
sport-stats
Sport stats UI components
Stars: ✭ 62 (-75.78%)
Mutual labels:  threejs
Agamari
🍙 Katamari × Agar.io
Stars: ✭ 46 (-82.03%)
Mutual labels:  threejs
roshar-map
An interactive map and timeline of Roshar, the planet that Brandon Sanderson's Stormlight Archive takes place on.
Stars: ✭ 48 (-81.25%)
Mutual labels:  threejs
NOC3D-chapter6
Nature of Code - Autonomous Agents examples in 3D
Stars: ✭ 69 (-73.05%)
Mutual labels:  threejs
x-ray.js
X-Ray a JavaScript Global Illumination Renderer for threejs
Stars: ✭ 21 (-91.8%)
Mutual labels:  threejs
expo-three-orbit-controls
🎥 Three.js Orbit Controls (Camera) bridged into React Native
Stars: ✭ 43 (-83.2%)
Mutual labels:  threejs
use-ammojs
ammo.js physics for use with react-three-fiber
Stars: ✭ 16 (-93.75%)
Mutual labels:  threejs
city-tour
A procedurally generated city built with WebGL and three.js
Stars: ✭ 57 (-77.73%)
Mutual labels:  threejs
webgl-image-processing-playground
Image processing shaders with WebGL
Stars: ✭ 15 (-94.14%)
Mutual labels:  threejs
web-hlmv
WebGL implementation of the Half-Life Model Viewer
Stars: ✭ 90 (-64.84%)
Mutual labels:  threejs
speckle-server
The Speckle Server, Frontend, 3D Viewer, & other JS utilities.
Stars: ✭ 224 (-12.5%)
Mutual labels:  threejs
Procedural-Generation
An Overview of Procedural Generation Techniques and Applications
Stars: ✭ 23 (-91.02%)
Mutual labels:  threejs
3dio Js
JavaScript toolkit for interior apps
Stars: ✭ 255 (-0.39%)
Mutual labels:  threejs
Vissonance
A WebGL Audio Visualizer
Stars: ✭ 39 (-84.77%)
Mutual labels:  threejs
THREEg.js
three.js addon to create special or extended geometries. The addon generates indexed or non indexed BufferGeometries.
Stars: ✭ 33 (-87.11%)
Mutual labels:  threejs

Build Status

THREE.IK

Inverse kinematics for three.js.

A work in progress, THREE.IK supports multiple chains with multiple effectors, solved via FABRIK iterative solver, and a ball-joint constraint. Best way to see how this works for now is to check out the demo, examples, and the docs.

⚠️ work in progress/request for feedback ⚠️

There are many open issues regarding axis alignment, new constraints, alternative solvers, and an API overhaul. Discussion and solutions are welcome! There will be breaking changes between versions as an API is settled on.

Installation

$ npm install --save three three-ik

or include the build at build/three-ik.js:

<script src="build/three-ik.js"></script>

Usage

You can use ES6 importing like so:

import { IK, IKChain, IKJoint, IKBallConstraint, IKHelper } from 'three-ik';

And here's a full example if included via script tag, with THREE.IK classes defined on THREE.

// Set up scene, camera, renderer
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100);
camera.position.z = 5;
const renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const ik = new THREE.IK();

const chain = new THREE.IKChain();
const constraints = [new THREE.IKBallConstraint(90)];
const bones = [];

// Create a target that the IK's effector will reach
// for.
const movingTarget = new THREE.Mesh(new THREE.SphereGeometry(0.1), new THREE.MeshBasicMaterial({ color: 0xff0000 }));
movingTarget.position.z = 2;
const pivot = new THREE.Object3D();
pivot.add(movingTarget);
scene.add(pivot);

// Create a chain of THREE.Bone's, each wrapped as an IKJoint
// and added to the IKChain
for (let i = 0; i < 10; i++) {
  const bone = new THREE.Bone();
  bone.position.y = i === 0 ? 0 : 0.5;

  if (bones[i - 1]) { bones[i - 1].add(bone); }
  bones.push(bone);

  // The last IKJoint must be added with a `target` as an end effector.
  const target = i === 9 ? movingTarget : null;
  chain.add(new THREE.IKJoint(bone, { constraints }), { target });
}

// Add the chain to the IK system
ik.add(chain);

// Ensure the root bone is added somewhere in the scene
scene.add(ik.getRootBone());

// Create a helper and add to the scene so we can visualize
// the bones
const helper = new THREE.IKHelper(ik);
scene.add(helper);

function animate() {
  pivot.rotation.x += 0.01;
  pivot.rotation.y += 0.01;
  pivot.rotation.z += 0.01;

  ik.solve();

  renderer.render(scene, camera);

  requestAnimationFrame(animate);
}

animate()

Documentation

Full API documentation can be found at https://jsantell.github.io/THREE.IK/docs.

Build

$ npm run build

Logo

The logo and artwork was created by Caitlyn Crites.

IK Resources

License

MIT License, Copyright © 2018 Jordan Santell

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].