# Get Location of an empty with shrinkwarp constraint

I like to read the location values of an empty by a phyton script. The empty has a shrinkwarp constraint an is projected to an plane (ground).

With >>>

bpy.data.objects['empty_left.005'].location


i get:

Vector((3.6352062225341797, 5.1430134773254395, 0.0))


but the z-value is the origin value and not the projection value.

If i use the z-value as a variable for a driver, the correct value is used:

• Could you upload your setup to pasteall.org/blend? – p2or Feb 28 '15 at 15:22
• @user2488 just apply the visual transform before reading the values and you will get what you want – Chebhou Feb 28 '15 at 17:58
• the empty follow a plane and change its z-value dynamicly, so i cannot apply the transformation! But the answer from pink vertex works fine! – user2488 Mar 2 '15 at 9:30

You can get the location from the world matrix:

empty.matrix_world.translation


you need to apply the visual transform 'which apply the constraint transform' to get the actual location of your object :

import bpy
ob = bpy.data.objects['Empty']
bpy.context.scene.objects.active = ob
bpy.ops.object.visual_transform_apply()
print(ob.location)