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)*




JAKOB WELNER
    _____________
    Animator | R&D
    jakob.welner.dk


On Tue, Jul 26, 2011 at 1:06 AM, notanymike <[email protected]> wrote:

> Update: I found out how to get the pole vector....It's actually a
> vector orthogonal to the vector of the effector to the start joint.
> However that's the vector as it lies on the rotate plane. How can I
> offset it to return a position that's normal for an "elbow control"
> i.e somewhere in between the start joint and effector, whilst keeping
> it parallel to the rotate plane/true pole vector?
>
> On Jul 25, 2:15 pm, Jan Berger <[email protected]> wrote:
> > I think it calculates the angle based on the angle between the start to
> mid
> > and mid to end vectors
> >
> > At 23:09 25.07.2011, you wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > >This is something I'd like to know as well, I though it may have
> > >something to do with the preferred angle, but no dice.
> >
> > >On Jul 20, 9:00 pm, notanymike <[email protected]> wrote:
> > > > How does the `ikHandle` command set up the initial pole vector? It
> > > > seems to take the vector between the start joint and it's position
> and
> > > > cast a vector orthogonal to it in the direction of the mid joint.
> I've
> > > > found code showing me how to calculate orthogonal vectors, but none
> > > > showing me how to do it when you only have one vector (the end joint
> -
> > > > the start joint). How do I get the other two axis and determine which
> > > > one to use for the pole vector?
> >
> > >--
> > >view archives:http://groups.google.com/group/python_inside_maya
> > >change your subscription settings:
> > >http://groups.google.com/group/python_inside_maya/subscribe
> >
> > Jan Berger
> > [email protected] ::www.janberger.de
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to