Aim Constraint Using Nodes

Hi, after having started watching Cult of Rig I’ve been trying to recreate the different constraints using standard Maya nodes.

In trying to find a solution for the aim constraint I stumbled upon a post on Lester Banks - the issue I found while trying to implement this one with nodes was I had no idea how to create a quaternion that specifies the rotation around a vector with a given angle.

My final solution was creating a vector for aim, up and the cross of those. Then supplying those to a 4x4 matrix to give it’s X, Y and Z axis directions, which I then decomposed and took the rotation from. In tests this have acted just like the aim constraint, but the above solution in code still eludes me how to implement using nodes.

Is it worth putting more time and effort into implementing this using quaternions or should the rotations from 4x4 matrices be stable enough to use?

Also as a more general question in implementing constraints using maya nodes, how do one steer clear of cycles. ie: getting the position of the position of an object that I later down the chain will want to rotate?

2 Likes

Hi Robberyman, nice setup, I just learned something from that, thx!
Can’t help you with the quaternions, but if you want to stay clear of the loop warnings you just have to make sure the attributes you are connecting aren’t looping.
In your case, instead of using the ‘decomp_aim’ node you can use a pointMatrixMult node, connect the parent matrix and the translation of ‘Aim_obj’ to it. That way you get the same point in space, but the rotation of the aim_obj doesn’t affect it’s translate values or it’s parent

Hope that helps, keep it up!

Edit: Mixed up vectorProductNode with pointMatrixMult node there

2 Likes