So i’m trying to recreate faith of the fallens awesome spine, but with python. What i’m attempting to do right now is setup some plus/minus average nodes and then add influence to the rotation of joints between the hip and shoulder based on the joints position in the chain. So in a 5 joint spine setup joint 3 (middle) would receive 50/50 influence from the shoulder and hip joint controls and the 4th joint would receive 25% from the hip and 75% influence from the shoulder.
I already know how to hard code this, it’s rather simple. What i’d like to do is to make it dynamic so it would be able to handle the influence distribution properly regardless if the chain was 5 joints long or 7 joints long. I already have all the joint information contained in arrays and the names of the nodes as well. I wouldn’t be surprised if i’m going about this in the wrong way either, any thoughts would be greatly appreciated.
If the joints are built with only 1 axis translation (typically .tx, but it depends on your joint setup) you can do this:
the total length is the sum of all the .tx’s. You could do this with add nodes or just calculate it at creation time if the spine does not stretch
Have a ‘partialLength’ attribute that is ‘my .tx + my parent’s partialLength’ for each bone.
each bone’s ‘bottom’ rotation is 1 - (partialLength / totalLength) and the ‘top’ rotation is partialLength / totalLength
Depending on the look you want you could also put a bias on the calculation
1 - ( (partialLength / totalLength) ^ pow ) and ( (partialLength / totalLength) ^ pow ).
You could do it with a a power of 1 would be linear. A power below 1 will shift influence downwards, and a power above 1 will shift it down – but it’s a hard control for animators to understand, so you might want to make a UI-only value that ramps between a hand-set min and max power number.