You don't need to convert both MPoint instances to MVector before subtracting them. As per the documentation page for MPoint <file:///Users/christopher/tmp/docs/maya-2016-ext2-developer-help/index.html#!/url=./cpp_ref/class_m_point.html> (check the `operator-(MPoint)` method), if you subtract two MPoint objects you get a MVector as a result:
vectorBetween = pointB - pointA Not sure why you'd want to avoid doing a subtraction? On 18 July 2016 at 16:08, Rudi Hammad <[email protected]> wrote: > hello, > I want to get the vector between two objects, so what I do is create > pointA and pointB as instances MPoints, and then > > vectorA = OpenMaya.MVector(pointA); vectorB = OpenMaya.MVector(pointB) > vectorBetween = vectorB - vectorA > > Out of curiosity,I was wondering if you can directly get the vector > between two objects without having to do the substraction. Something like > vectorBetween = OpenMaya.MVector(pointA, pointB) > Does MVector return only vectors having the origin in (0,0,0) > > thx > > > -- > 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/aff78d2f-5805-4703-84f6-e89d1ac184d7%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/aff78d2f-5805-4703-84f6-e89d1ac184d7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Christopher Crouzet *http://christophercrouzet.com* <http://christophercrouzet.com> -- 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/CANuKW500w7HzNYiNhjw7Jg8h-%3D22viRDnaxwn-9FxQ4DSZA0CA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
