Hi, i want to know how do i transform one vector in one coordinate systeme to another object coordinate system. Thanks
I think that a vector v1 in the reference system of object1 can be expressed in the reference system of object2 as:
v2 = M2 * M1.transposed()*v1
M1 = object1.worldOrientation
M2 = object2.worldOrientation
Vectors can be transformed by rotating them by an object’s orientation matrix. You can undo a transformation using the inverse of the matrix.
# example vector in world coordinates vec = mathutils.Vector([1, 0, 0]) # transforming to an object's coordinate system vec.rotate(obj.worldOrientation) # undoing the transform vec.rotate(obj.worldOrientation.inverted())
Thanks for your help