enhancing offsets


(Paul_C) #1

I was constructing a female character this week, and have given her a pony tail and “side burn” type strands of hair that come down in front of her ears. I have set up an IK armature inside all three parts of the hair, where each bone is constrained to two empties (much like the IK foot constraints seen in previous IK animations). I have offset the time for each empty down the chain so that I can achieve a “wobble” effect for when the head turns or moves, and the hair has a little lag effect.

Here is my problem: When the chain of empties follow, their end position is abrupt, and there is no “bounce back” action. Up until now, I have keyframed the bounce back on each empty in the chain, but this sort of keyframing makes the whole idea of offsetting redundant.

Is there a python script out there (much like camera jitter, for instance) that will add a little bounce to offsetted objects?

Am still learning python, so if anyone with good programming skills would like to help me work on one, please contact me. I will send you the blend files showing you what I intend to do.

Cheers,

Paul C
:wink:


(RipSting) #2

Is there a python script out there (much like camera jitter, for instance) that will add a little bounce to offsetted objects?

Why yes there is… I created a script a few months ago called Tangix, my “elastic gravity simulator”. It requires a fair amount of tweaking to get the desired results, but you can simulate anything from a ball on a rubber band to a chain. This can be used with empties and armatures set to track them to do what you want for the hair. Download it from here:

http://www.fireengine51.org/blender/tangix.zip


(Paul_C) #3

It works… but all my empties seem to want to go down, and this stretches out the chain beyond the point I want it to go. I studied your script, and saw something along the lines of “children don’t stray too far from parents - not implemented”

THe chain is about ten units from the 0,0,0 vertex: does this effect the empties path?

Also, you mentioned it may need tweaking. Am trying to figure out what parts of the coding to tweak. The script is easy enough to follow. I guess I want some pointers as to where to make changes. Apart from that, the motion it produces is perfect! A realistic swaying and delay.

One more thing: Does it only work the one time around? I can’t seem to “reset” all the positions.


(kurppa) #4

a very cool scipt! just one q though…

is it possible to do the same thing for rotations? now the chain only acts to the “Loc” movements but what about “Rot”… for the hair expecially it would be nice to have the hair strands follow the head’s rotation in the same way. and so much much more. swirling stuff ect… is it possible with the current state of affairs?

RipSting or any cool guy with python abilities & time wanna give it a shot?

or does a script like that allready exist? if so please let me know… have been looking one for quite a while…


(RipSting) #5

I can’t seem to “reset” all the positions

Ya, this script is crappy that way. I didn’t feel like taking the time to set up a persistant array of the original positions. Also, this script assumes that 1 frame in the animation = 1 frame (if you’re using motion blur with 8 samples, it will think it’s 1 frame = 8 frames). Really it’s not the greatest physics script in the world, but it did what I needed it to.

THe chain is about ten units from the 0,0,0 vertex: does this effect the empties path?

I assume you mean the origin? No, it doesn’t make a difference to the script since it’s all in relation to the parent object.

Also, you mentioned it may need tweaking

Well I meant the user-definable properties at the top of the script, but you can change the code if you want.

Basically the child is always affected by gravity & viscosity, but the elasticity effect only kicks in when the child reaches a certain distance from the parent (the length property). It then applies force in the direction towards the parent until it is within the allowed length from the parent. Simple enough.

is it possible to do the same thing for rotations?

I guess it would be possible, but I wasn’t thinking about that when I wrote the script. It would take some extra variables and things. It shouldn’t be TOO hard, but I’m busy with other scripts at the moment so anyone can modify it if they want.