MAYA TUTORIAL : placing correctly a pole vector with math and python

Hi guys!
I am here to share my last two tutorials for maya.
They are about how to correctly place a polevector in maya in a way that when you create the polevector constraint your chain wont move , also it will be possible to offset the locator and so on.
Everything is done by doing some vector math and using python!
comment and critique are welcome!
If you want to stay up to date with the releases of tutorial/scripts and plugin just subscribe to the newsletter or follow me on vimeo :

http://www.marcogiordanotd.com/newsletter.php

here the tutorials :
pt1 : https://vimeo.com/66015036

pt2 : https://vimeo.com/66262994

1 Like

if you place it on a chain like for example an arm you can either place it on the elbow or if you want to place it with an offset just create a triangle with polys with each vertex positioned at a joint, then scale that triangle up from either the wrist or shoulder (or if you can find it the exact center between these 2) and place the polevector on the point of the triangle that is moved away form the elbow

If you watch the video I explain exactly that :slight_smile: but those are “tricks” not a clean way to do stuff
The reasons for that are simple :

  1. placingo n the elbow : that s pain for the animator which most of the time loos e the controll inside the geometry, or if it will move the arm back from that position on it will flip , they ask me that so many time in production
  2. Using the plane and geometry constraint require quite a bit of interaction with the scene , creating data deleting that which is way more than you need , also If you do an autorig with a lot of interaction in the scene at build time you will see you will get slow performance at build time .

Also in the second part i show how to orient also the pole vector correctly which might be usefull aswell.

So in the end I just show a nice and clean way to do it , and also the math i explain is super usefull for a TD trust me on that

ok yea, did not see the videos yet (lot of work to do still) but using the triangle is how i always do it when i create rigs. will have a look at your videos this weekend. vector math is always cool ^^

Thanks Giordi, I have translated your cool way with MEL. Previously, I wrote a script for myself doing the same thing but using the polyPlane method. It works but not as good as your method. I will share this MEL translation for the benefit of everybody since I needed to translate this into MEL for a very old script of mine. I am thinking of translating this to maxscript as well…maybe next time.

string $jtPV[] = ls -sl;
vector $aVec = xform -q -ws -t $jtPV[0];
vector $bVec = xform -q -ws -t $jtPV[1];
vector $cVec = xform -q -ws -t $jtPV[2];
vector $caVec = $cVec - $aVec;
vector $baVec = $bVec - $aVec;
float $dotP = dotProduct($caVec,$baVec,0);
float $proj = ($dotP / mag($caVec));
vector $caVecNormalized = unit $caVec;
vector $projV = $caVecNormalized * $proj;
vector $arrowV = $baVec - $projV;
vector $finalV = $arrowV + $bVec;
float $finalV_xForm[] = $finalV;
spaceLocator -n “myPV”;
move $finalV_xForm[0] $finalV_xForm[1] $finalV_xForm[2] “myPV”;

1 Like

[QUOTE=ricoMambo;21139]Thanks Giordi, I have translated your cool way with MEL. Previously, I wrote a script for myself doing the same thing but using the polyPlane method. It works but not as good as your method. I will share this MEL translation for the benefit of everybody since I needed to translate this into MEL for a very old script of mine. I am thinking of translating this to maxscript as well…maybe next time.

string $jtPV[] = ls -sl;
vector $aVec = xform -q -ws -t $jtPV[0];
vector $bVec = xform -q -ws -t $jtPV[1];
vector $cVec = xform -q -ws -t $jtPV[2];
vector $caVec = $cVec - $aVec;
vector $baVec = $bVec - $aVec;
float $dotP = dotProduct($caVec,$baVec,0);
float $proj = ($dotP / mag($caVec));
vector $caVecNormalized = unit $caVec;
vector $projV = $caVecNormalized * $proj;
vector $arrowV = $baVec - $projV;
vector $finalV = $arrowV + $bVec;
float $finalV_xForm[] = $finalV;
spaceLocator -n “myPV”;
move $finalV_xForm[0] $finalV_xForm[1] $finalV_xForm[2] “myPV”;[/QUOTE]

sorry not a mel fan :stuck_out_tongue: but cool mane yeah mel has a handy vector class aswell well done!

Yes, I like Python better,too. Python is more professional…but some of my old scripts were written in MEL.

[QUOTE=ricoMambo;21171]Yes, I like Python better,too. Python is more professional…but some of my old scripts were written in MEL.[/QUOTE]

Well is not about professional is more about what you can do with python , python is whildely used and you have library for everything ,math , grapich UI ,file parsing etc etc and you can use all of this based on what you have to do , and also of course object oriented