Hi Sam, As I was surprised your code used to work I just tried it in Maya 2014 and I have the same error than (which I expected) Python doesn't define any vector type, only arrays or list. Thus cross product does not mean anything on arrays :)
Better store your vectors to the MVector api class. Something like: import maya.api.OpenMaya as om v1, v2 = om.MVector(vec1), om.MVector(vec2) print v1 ^ v2 Hope that helps, N. --- [image: Nicolas Chaverou - Golaem Crowd Product Manager - Golaem SA] +33 (0)2 99 27 21 44 http://www.golaem.com On Mon, Mar 21, 2016 at 12:34 PM, <[email protected]> wrote: > Hello, > > i have been using this method to get the cross product of two vectors: > > ##### > > 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 > > #### > > with the '^' symbol this process works when i tried it at home on maya > 2015 in python tab of script editor. > > I dont know what has changed but when i tried it at work using maya 2016 > in script editor it returns this: > > # Error: TypeError: file <maya console> line 14: unsupported operand > type(s) for ^: 'tuple' and 'tuple' # > > i don't think i have done anything different in my new script as it seems > to match my other one. Can anyone tell me why the cross product operator ^ > doesn't seem to work here? > > thanks alot, > Sam > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/f119d42e-75bf-44b5-88bf-d39e660e1aed%40googlegroups.com > . > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFS5DCZOreM7ZJQpAjjzeikxA-khb5u86YjZLWN7SbrswEE0Hw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
