cool thanks Geordie,

yea i guess subtraction bit is easier, but i would think overall both
methods would take as long to write out with having to make pynodes to
begin with. But its a nice alternative

thanks,
Sam

On 22 March 2016 at 02:58, Geordie Martinez <geordiemarti...@gmail.com>
wrote:

> you can make it a LOT easier of you just stay in pymel and skip maya.cmds.
> here is an example of what you’re doing:
>
> import pymel.core as pm
> # make pynodes out of each locator or transform
> loc1=pm.PyNode('locator1')
> loc2=pm.PyNode('locator2')
> loc3=pm.PyNode('locator3')
> # get the World space position of each locator# each of these returns a Point
> pt1=loc1.getTranslation(space='world')
> pt2=loc2.getTranslation(space='world')
> pt3=loc3.getTranslation(space='world')
> # to get vectors subtract one point from another# returns a Vector
> vec1=pt2 - pt1
> vec2=pt3 - pt1
> # .cross() is a method on any vector
> cross = vec1.cross(vec2).normal() # add .normal() to normalize
>
> ​
>
> On Mon, Mar 21, 2016 at 8:10 AM, <s...@weacceptyou.com> wrote:
>
>> sorry i meant to write this the first time. this seems to work:
>>
>> ####
>> pt1=cmds.pointPosition('locator1')
>> pt2=cmds.pointPosition('locator2')
>> pt3=cmds.pointPosition('locator3')
>>
>> vec1=pm.dt.Vector(pt2[0]-pt1[0],pt2[1]-pt1[1],pt2[2]-pt1[2])
>> vec2=pm.dt.Vector(pt3[0]-pt1[0],pt3[1]-pt1[1],pt3[2]-pt1[2])
>>
>> perpenVec=vec1^vec2
>> ###
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/df047714-b73d-4af9-badc-6c10179cc4ee%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python_inside_maya/Fbk_J8KVzaQ/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CABPXW4igxQVyBuiaLuSQ8BjSeFWmMZygBxGGnm2XbYFapykfPA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CABPXW4igxQVyBuiaLuSQ8BjSeFWmMZygBxGGnm2XbYFapykfPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CA%2BGceHUvR-g_o351N9W4GKOyOJ_PK-eAduLZPM%2BVZOjQU1_3Ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to