• Create Account

## Inverse Kinematics help

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1BlackBrain  Members

509
Like
0Likes
Like

Posted 11 August 2014 - 07:26 AM

Hello .

I have skeletal animation in my engine right now and it's working good,however, it's not enough . I would like to add IK to my characters so that I can let's say control their right hand position after animation update . I don't know how IK is done . Can you please give me instructions or give me a refrence to read further about this ?

### #2JohnnyCode  Members

1064
Like
1Likes
Like

Posted 11 August 2014 - 05:08 PM

Inverse Kinematics are a procedural animation. For that you need explicit defintion of a skin mesh (weights and bones). And if you set a certain bone to an explicit transformation, it is supposed to affect all parenting bones to the very root of subtree.

This is rather not any trivial topic, and- it is even rarely implemented or needed actualy, so no straight links for you to see.

But, what I can tell you is that- if you set a right hand bone to be position at a point, you will need to

-  compute final skeleton from manner of influence towards ancestry

- blend from current one to final one

you may compute the final one in MANY MANY manners, such as, root of most influenced ancestor volatiles, but other roots dont and so on.

IK is a wide bunch of stuff and you may need only 5 percents of it.

Describe what you wish to achieve rather

### #3BlackBrain  Members

509
Like
0Likes
Like

Posted 12 August 2014 - 07:58 AM

I wish that I can let's say set the position of right hand then the shoulder and elbow fix their rotation so that the right hand position would be correct. Also I need to correct the foot position in order that the foot will all ways be on floor or ground when moving on a stair or a slope. I just wish to know how can I get correct rotation for corresponding bones and apply that to them.

### #4BlackBrain  Members

509
Like
0Likes
Like

Posted 12 August 2014 - 08:09 AM

I wish simple things Let's say : preventing the foot of the character go below the ground. I would like to set the position of the foot and the thigh and knee adjust their rotation so that the foot would reach the set position. Or for the hand the exact same thing , I set the position of the hand and shoulder and elbow adjust their rotation.

I wish to know how can I get the correct rotation and further apply them to bones ?

### #5JohnnyCode  Members

1064
Like
1Likes
Like

Posted 12 August 2014 - 10:57 AM

you cannot set a position of foot freely, as it would severe if very center of skeleton cannot be moved.

What you want to achieve is a physicaly jointed structure.

It would serve your purpose totaly. You can restrict joints angles of freedom and so on, If you can grab some physical engine library, I would recommend you that direction.

### #6Matt Booth  Members

285
Like
1Likes
Like

Posted 14 August 2014 - 05:41 PM

IK can get pretty complicated. There is a great talk on GDC Vault from this year:

http://www.gdcvault.com/play/1020056/Math-for-Game-Programmers-Inverse

Part of the complexity is due to the fact that kinematics (animations) have one solution, whereas IK has many. CCD (Cyclic Coordinate Descent) is a popular method and a good place to start if you're determined to write it yourself.

If it feels like that content is going over your head I'd agree with JohnnyCode, grab a third party library and at least get used to how they solve the issue, then try again armed with that knowledge.

### #7BlackBrain  Members

509
Like
0Likes
Like

Posted 15 August 2014 - 06:02 PM

Thanks . I don't need complex IK. I want to use it as a post process after the animations are played so that let's say a character can hold his hand to the wall . I get the wall position by raycating and setting the hand's positon. This is all I am looking for.

### #8Ashaman73  Members

13651
Like
1Likes
Like

Posted 17 August 2014 - 11:55 PM

I get the wall position by raycating and setting the hand's positon. This is all I am looking for.

Well, but this is the complicated case. The complexity depends on the number of modified bones. A simple, single bone head tracking or a two bone leg on ground IK are some special cases which could be hacked .

Sure, you are only want to place a single bone , eg your hand bone. But then you need to fit in all other bones to support the pose while keeping the general pose of the given animation. Eg. the upper body need to react to the hand on wall scenario (bending over ). In this case, additionally to  your hand bone, you will most likely need to adjust the wrist,lower arm, upper-arm, shoulder and 1-3 spine bones too. Adjusting this kind of complex IK without considering more complex IK sovler is no fun at all

Ashaman

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.