-
Puppet Physics. PuppetTools + Elastic Connection
Hey guys,
Im having a bit of a struggle trying to hack together 2 expressions.
I have used the script PuppetToolsV3 from AEscripts to connect a puppet pin to a null.
Expression:
fromComp(thisComp.layer("MyPuppet | Puppet Pin 1").toComp(thisComp.layer("MyPuppet | Puppet Pin 1").anchorPoint));
But now I would love to add some of Ebberts’ Elastic Connection magic from MotionScript to the equation.Expression:
restLength = 20;
damp = .95;
leader = thisComp.layer("leader");fDur = thisComp.frameDuration;
currFrame = Math.round(time / fDur);p2 = position.valueAtTime(0);
v2 = 0;
for (f = 0; f <= currFrame; f++){
t = f*fDur;
p1 = leader.transform.position.valueAtTime(t);
delta = p2 - p1;
nDelta = normalize(delta);
a = 2 * nDelta * (length(delta) - restLength) * fDur;
v2 = (v2 - a) * damp;
p2 += v2;
}
p2
Can someone please help me work out how to ‘smoosh’ these together,
so the puppet pin follows the null with some elastic physics?
I can’t quite work out how to make it work.Thanks in advance 🙂