Comparing Axis

hello

im starting to forray into some vector and matrix stuff, and finding it quite daunting, and i was playing around with the vector product node. basically im looking to compare the orientation of a control to the world so i can base aim vecors on and other such decisions in my scripts. and im not sure if im plugging in the correct values.

can i just plug in the rotation for this? or is it a matrix calculation thing? if so what matrix, theres so many!! or is there a better way to find out what local axis of an object matches the world z axis? i was looking at using xform -q -ws- rotation but that seems a bit messy (and i suppose im a bit lazy )

any help would be great

thanks all

QUOTE(andylt1 @ 03/12/08, 02:25 PM) [snapback]282490[/snapback]
can i just plug in the rotation for this?

Sure, but rotation isn't a vector, so theres no sane result. However what you do is you take out the vector of the axis in local sapce you may want to use adn vector multiply it with the world matrix (you are afeter the world space transformation). Or just connect the firt row of the matrix in as your vector if you dont want slanted vectors.

QUOTE
if so what matrix, theres so many!!

yes theres one matrix for each trasform in the scene, plus the cached inverse of thet matrix, world compound, and inverse world. Depending on what space you would like to use. (inverses are there so you can traverse the info in reverse order)

thanks

this is kinda makin sense. but im still a bit unsure on what to plug in where. i tried to plug in the world matrix of the control (or a locator as a quick test) to the matrix of a VP node and tried some different settings but to be honest at the moment i dont think id know the correct result if i produced it! :S

i think im guna have to bury my head in some books to get this. if its no too cheecky is there any chance of a quick explanation on what setting an attritbutes to use.

thanks for the reply though

appreciate it

CODE
{
file -f -new;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1
       -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1
       -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
rotate -r -os -6.541542 14.95247 -28.583016;
move -r -os -wd 2.852896 0 0;
createNode vectorProduct;
createNode vectorProduct;
createNode vectorProduct;
connectAttr -f nurbsSphereShape1.worldMatrix[0] vectorProduct1.matrix;
connectAttr -f nurbsSphereShape2.worldMatrix[0] vectorProduct2.matrix;
connectAttr -force vectorProduct1.output vectorProduct3.input1;
connectAttr -force vectorProduct2.output vectorProduct3.input2;
setAttr "vectorProduct1.input1X" 1;
setAttr "vectorProduct2.input1X" 1;
setAttr "vectorProduct1.normalizeOutput" 1;
setAttr "vectorProduct2.normalizeOutput" 1;
setAttr vectorProduct1.operation 3;
setAttr vectorProduct2.operation 3;
setAttr vectorProduct3.operation 1;
$prod=getAttr("vectorProduct3.outputX");
print("angle Between the balls is "+(acosd($prod)) );
}

joojaa you are indeed a gentleman and a scholar
thats awesome thanks for the help. only had time to give it quick look late last night but, it intanlty made more sense, i will give it a good digging through today.

cheers man