MVector¶
-
class
MVector
(*args)¶ Bases:
OpenMaya.MVector
Override of the Maya API class of the same name to make the data within the class ‘picklable’
Methods Summary
normal
()Returns a new vector containing the normalized version of this one. normalize
()Normalizes this vector in-place and returns a new reference to it. rotateBy
(*args)Returns the vector resulting from rotating this one by the given amount. rotateTo
(target)Returns the quaternion which will rotate this vector into another. transformAsNormal
(matrix)Returns a new vector which is calculated by postmultiplying this vector by the transpose of the given matrix’s inverse and then normalizing the result. Methods Documentation
-
normal
()¶ Returns a new vector containing the normalized version of this one.
RETURNS MVector
>>> new_v = v.normal()
-
normalize
()¶ Normalizes this vector in-place and returns a new reference to it.
RETURNS MVector
>>> v.normalize()
-
rotateBy
(*args)¶ Returns the vector resulting from rotating this one by the given amount.
args single MQuaternion or MEulerRotation, or an axis identifier constant and a float angle
RETURNS MVector
>>> ##---rotate by MQuaternion or MEulerRotation---## >>> new_v = v.rotateBy(rot) >>> >>> ##---rotate by angle radians about the specified axis---## >>> new_v = v.rotateBy(MVector.kXaxis, 5.0)
-
rotateTo
(target)¶ Returns the quaternion which will rotate this vector into another.
target MVector
RETURNS MQuaternion
>>> q = v.rotateTo(MVector(1.0, 0.0, 0.0))
-
transformAsNormal
(matrix)¶ Returns a new vector which is calculated by postmultiplying this vector by the transpose of the given matrix’s inverse and then normalizing the result.
matrix MMatrix
RETURNS MVector
>>> matrix = MMatrix() >>> new_v = v.transformAsNormal(matrix)
-