Copy link to clipboard
Copied
Need some help on something.
I am setting up a basic rig for an arm. I want to be able to move a null along the x-axis which will, intern, rotate the shoulder with it. As you can see from the video I have it working (sort of) but my rotation is wrong.
I have this expression on the shoulder null object:
thisComp.layer("Wrist_CTRL").transform.position [0];
I have tried adding this expression but get an error
p = thisComp.layer("Wrist_CTRL").transform.rotation;
value + [0,p.valueAtTime(0)[1] - p[1]]
Thanks in advance
Copy link to clipboard
Copied
You can calculate the rotation between two points with an expression like this:
Pt1 = thisComp.layer("Point 1").transform.position;
Pt2 = thisComp.layer("Point 2").transform.position;
v = Pt2-Pt1;
radiansToDegrees(Math.atan2(v[1],v[0]))
Apply it to your shoulder layer rotation. Modify it so that Pt1 is your 'shoulder layer'. Pt2 should be your elbow position - not your wrist. But this is still not going to do what you want because you'll need to adjust the position of the elbow null to match the position of the end of the upper arm as it rotates at the shoulder.
If you're setting up a more complex rig you might want to look at a free script like DUIK:
https://rainboxprod.coop/en/tools/duik/
This is a much more powerful toolkit for this sort of jointed character rigging - and other similar techniques. Look up 'Inverse kinematics (IK)'
Copy link to clipboard
Copied
I agree with @Mike_Abbott (btw: why it's such a pain to mention people... I get Mike_9digitslong but not the guy in the post above ).
You are about to create inverse kinematic, but if you are not really want to go through the pain of coding a badass expression, reach out to DUIK.
There are free tutorials online, taking lass than an hour. If you skip to the essential parts, you can create your arm-rig in 10 till 20 minutes and it will be include everything you ever asked for. There is also a video tutorial from the creator. It's not for free, but you'll learn a lot.
*Martin
Copy link to clipboard
Copied
Thanks.
I know about IK and I have Duik on my desktop. However, this is not a complex rig and just want an IK for this arm only.
I'll tinker some more and hopefully get there
Copy link to clipboard
Copied
However, this is not a complex rig and just want an IK for this arm only.
You can create small rigs for one single limp with DUIK, too.
If you know how to use DUIK, rigging the arm is a 5 minute job and way easier then trying to write your own IK expression or going to Ebberts goldmine and applying his (I won't imply that visiting Ebberts page isn't worth the time - it's always enriching!).
*Martin
Copy link to clipboard
Copied
OK that's great.
Copy link to clipboard
Copied
If you want to cook your own rig the very first place to visit is Motionscript.com. This ancient page from brother Dan will do it: Inverse Kinematics.
Copy link to clipboard
Copied
Ah - good call Rick. I hadn't realised that was in the Ebberts goldmine.