Skip to content

philiparvidsson/Inverse-Kinematics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Experimenting with Inverse Kinematics

This was an assignment for one of my courses during my studies; implementing an IK solver. I took it a few steps further and implemented some physics and a Phong-shader.

I implemented a simple 3D environment with some basic physics (a simple symplectic Euler solver with a sphere vs. axis-aligned bounding box a posteriori collision solver) to demonstrate the algorithm. The video below is a recording of the demo (clone this repository to build it yourself).

Inverse Kinematics

Building the demo from source

Prerequisites

  • MonoA software platform designed to allow developers to easily create cross platform applications part of the .NET Foundation.
  • MonoGameAn Open Source implementation of the Microsoft XNA 4 Framework.

Linux/macOS

  1. Clone this repository:
    git clone https://github.com/philiparvidsson/Inverse-Kinematics
  2. Compile the game:  
    cd Inverse-Kinematics
    make
  3. You should now be able to run it:
    make run

Algorithm

I came up with a pretty simple algorithm for the IK system during the assignment:

n ← number of bones
for i from n-1 to 0
    a ← vector from end of segment to beginning of segment
    b ← vector from target to beginning of segment
    
    if length of b  < length of a then
        increase compensating angle for bone i by some amount
        
    relax compensating angle for bone i by some factor
    
    r ← 0
    f ← 1
    for j from i to n-1
        r ← r + f * compensating angle of bone j
        f ← f + 1
        
    rotate bone j around axis (a x b) by some amount minus r

Although it is based on classic IK solutions (rotating each bone towards the target iteratively), the concept of compensating angles helps it "back away" to reach nearby (closer to the root point than the length of the sum of all bones in the chain) targets while displaying relatively stable motor skills.

About

During a research project, I came up with a pretty interesting algorithm for solving Inverse Kinematics problems iteratively. Check out the video!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published