Maya aim matrix & joints

Hi,

I’ve been looking into Maya’s matrix nodes and I’ve been trying to aim a joint at a locator using the aim matrix.

I’ve been having trouble getting this to work, in the example below the pink locator is pointing and following the yellow locator and the joint should be doing that same, but I can’t figure out the maths.

The image has my node network, the aim matrix at the bottom is for the pink locator and the top is for the joint. I have to be careful with using the world matrix(or local) because I’ll run into a cycle error, that’s why i’m using the parent matrix and joint translation for the top aim matrix.

I realised that the result of the aim constraint for the top is based off the parent matrix rotation, which is why it’s incorrect, and now i’m stuck…

I’m not sure where to go from here, can anyone offer some guidance, I would really appreciate it!

Thankyou

mtxanim
mtxanim2

Hi there!

Usually with this kind of issue I try to keep things simple. The traditional approach to utilising a aim or lookat for your joints you would either:

A: Use a simple aim constraint with a designated locator to track your up vector
B: Use an RP IK to aim at its effector joint, which will remove any gimbal flipping.

I personally prefer using IK as its alot faster and more reliable.

Heres a demo gif comparing the two:
Animation

Here is the maya scene for you to play with:
https://drive.google.com/file/d/1NnBigJilgIXnuR9RBFV6A-syWZHBB0Mk/view?usp=sharing

Hope that helps :slightly_smiling_face: :+1:

1 Like

Thanks for an alternative setup JosephC, for the purpose of my rig I found aim constraint’s to be unstable, although I didn’t try RP IK. So I’ll test it when I get a chance.

But after playing around with the setup I came up with a solution. By storing the world location of the joint in another matrix node, I can avoid the cycle error. After aiming I multiply the result by the world inverse to get the local matrix. This just contains the offset matrix which I can decompose and apply to the joint.
mtxanimfixed

1 Like

Not sure if you already had a look, but a while back i had similar issues trying to figure this out.