How can I get the absolute position in 3d space of a face using python. I can get the position relative to the object origin using face.calc_center_median()
this is not the absolute 3d position.
Here is how I got the relative position:
import bpy
import bmesh
# get current mesh
current_mesh = bpy.context.object.data
# create empty bmesh, add current mesh into empty bmesh
current_bm = bmesh.new()
current_bm.from_mesh(current_mesh)
# TODO: get absolute position
# get location of face (atm it relative to object origin)
for face in current_bm.faces:
face_location = face.calc_center_median()
normal = face.normal
x = face_location[0]
y = face_location[1]
z = face_location[2]
print('index: '+str(face.index), x, y, z) # DEBUG
# current_bmesh back to mesh
current_bm.to_mesh(current_mesh)
current_bm.free()
In this scene for example the cube is a good distance from the world origin, the absolute 3d shall reflect this.
These are the reported coordinates of each face (they are relative to the origin of the object)