# How to get an object to display its actual position after transform using parenting with empty using python [duplicate]

Currently this code creates an empty at a defined position and have used parent to get an object, in this case a cube to be in that position. However the newly created cube states its position as the origin rather than its actual position. How would I get the cube to display its actual position which would be the same as the empty?

import bpy
from mathutils import Matrix, Vector

context = bpy.context
scale = 0.01

x, y, z, l, m, n, p, q, r = -500, 200, 1000, 1, 0, 0, 0, 0, -1

y_axis = Vector((l, m, n))
z_axis = Vector((p, q, r))

x_axis = y_axis.cross(z_axis).normalized()

M = Matrix((x_axis, y_axis, z_axis)).transposed()

M = M.to_4x4()

M.translation = scale * Vector((x, y, z))

print(M)
print(x_axis, y_axis, z_axis)
mt = context.object
mt.empty_display_type = 'ARROWS'
empty = bpy.context.object
mt.matrix_world = M


• Why not using the matrix again? my_cube.matrix_world.translation? Don't get your question... Apr 30, 2020 at 10:11