I’m trying to get the global coordinates of each vertex in a mesh. To test I have a mesh named “tester” composed of a single vertex. The forums have guided in writing this:
import bpy
from mathutils import *
def A():
actOb = bpy.context.scene.objects['tester']
wmtx = actOb.matrix_world.inverted()
vertList = [(vertex.co *wmtx) for vertex in actOb.data.vertices]
for v in vertList:
print (v)
A()
But the printed values are different from the values in the Transform dropdown in the view properties (see attached pic). What am I missing?
don’t invert the matrix… world matrix transforms local space to world space. object.data.mesh.vertcies[n].co gives a local space vector. So multiplying that by the inverse is not the operation you are after.
Thanks for the reply patmo141! I removed the inversion and it gives me the same thing. Any idea why the last value (Z value I assume) doesn’t match the value in the “Transform” slider?