# Tag: IK

## Soft IK

If you haven’t heard of soft IK before, please read http://www.softimageblog.com/archives/108. Andy Nicholas explains the problem very clearly. Essentially it adds a “soft” distance and slow down the movement causing the pop with a formula. Andy showed this in Softimage but the idea works anywhere.

Below are some lines of expression showing the ideas in maya. They are running node-based in my final rig but making the setup works in expression first is faster for me.

```// -----------------------------------------------------------
//     \$d : current distance betw ends
//     \$D : initial distance betw ends
//     \$S : IK softness
//
//     softJ_start & softJ_end
//         a 2-joint chain with it's IK parented under e.g. foot ctrl
//         the main IK is point constrainted to softJ_end
// -----------------------------------------------------------

float \$S = ctrl.soft;
float \$D_soft = \$D - \$S;
float \$new_d = \$d;

if ( \$d > \$D_soft ) {
float \$x = \$d - \$D_soft;
\$new_d = \$D_soft + \$S *( 1-exp(-\$x) );
}

softJ_end.ty = \$new_d;
```

## Rotate Order

Arrrr . . . it’s been a while doing bunch of various stuff. Finally I got sth to share while scripting my autorig system.

Usually I don’t care about gimbal lock since I discovered the “euler filter” button in graph editor. And I always thought that better rotate order means cleaner animation curves only. Recently I found another case showing the importance of proper rotate order.

Imagine a standard 3-joint IK arm (say, left arm) with simple pole vector setup. When the character moves his arm ( ikHandle ) forward and about to the right, the upper arm joint’s rotation would pop from (0, -89.x, 0) to crazy values like (180, -89.x, -180). It took me a while to think about it . . .

A better rotate order seems to help.

Here is the best gimbal lock explanation I’ve seen https://www.youtube.com/watch?v=zc8b2Jo7mno.