Thanks Jakob, however I'm not trying to create a pole vector, I'm
trying to move one to follow the joints rotations using a custom
transform node. The problem I'm having with the node is that it can't
find the original pole vector's position based on it's parent matrix
and the joint chain. It does find the proper vector midway, but I
derived the math from ZooTools (
http://zootoolbox.googlecode.com/svn/
branches/dave/zooVectors.mel) and I can't figure out how to get the
'distance' to match the distance the pole is from the elbow. For now
I've simply added a attribute to my node letting the animator specify
any distance they want, but the control will sill jump once
'enableSnapping' is set to true. How do I apply the pole vector's
position to zooFindPolePosition's distance argument to return the same
distance/position that the elbow control is to the elbow?
On Jul 31, 8:33 am, Jakob Welner <
jakob.wel...@gmail.com> wrote:
> Here's a simple way of doing it.
> It's basically getting the vector from wrist to elbow and from shoulder to
> elbow, adding them together to get another vector pointing away from the
> elbow but sticking to the rotation plane, normalize it so you're sure to
> have the same distance all the time, multiply with whichever distance you
> want from the elbow and there you go. To get the actual WorldSpace position
> of the polevector then, you simply add the elbow position.
> Does that make sense?
>
> *import pymel.core.datatypes as dt
>
> def __snapPolevector(wrist, elbow, shoulder, poleVec):
>
> distFromElbow = 5
>
> wristPos = dt.Vector( mc.xform(wrist, q=True, translation=True,
> worldSpace=True) )
> elbowPos = dt.Vector( mc.xform(elbow, q=True, translation=True,
> worldSpace=True) )
> shoulderPos = dt.Vector( mc.xform(shoulder, q=True,
> translation=True, worldSpace=True) )
>
> vWristElbow = elbowPos - wristPos
> vShoulderElbow = elbowPos - shoulderPos
>
> vDir = vWristElbow + vShoulderElbow
> vDir.normalize()
> vDir = vDir * distFromElbow
>
> poleVecMatch = elbowPos + vDir
>
> mc.xform(poleVec, translation = poleVecMatch, worldSpace=True)*