Inverse Kinematics help

Started by
6 comments, last by Ashaman73 9 years, 8 months ago

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 ?

Thanks in advance

Advertisement

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

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.

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 ?

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.

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.

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.


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 smile.png

This topic is closed to new replies.

Advertisement