# How to get Z Euler Rotation value of constrained object?

I have a shader that uses the Z rotation of an empty (called Sara_Origin) through drivers to calculate the shadows on the face. The empty's rotation is constrained to the head bone of the character using a Child Of constraint.

The problem is when rotating the head bone, the empty's rotation doesn't update since it's using a Child Of constraint. Rotating the empty itself works fine.

Is there a way to find the Z Euler rotation value of the empty after it has been rotated through the constraint?

Blend file

• Would be nice if you could link the blend file with materials again, so that others can better understand the scene and learn from it... May 10, 2022 at 8:37

Is there a way to find the Z Euler rotation value of the empty after it has been rotated through the constraint?

Yes.

There are two different ways to get an object's transform into a driver:

One way gets the raw f-curve data, by driving from a "single property", set to the appropriate path. This gets the number that you see in your transform fields when selecting the object. It takes into account f-curves, f-curve modifiers, and drivers. It does not take constraints into account. It is always in the local space of the target.

The second way is to drive from a "transform channel" in the driver. This is the value after any constraints have been applied. It is also remapped from what you might expect your raw values to be: rotations will be remapped to the -180, 180 range and Euler angles will be anti-aliased into whatever method Blender uses (like a 180,0,180 XYZ is going to be read as a 0,180,0 Euler.)

Both methods are useful. For people making rotating gear ratios, they need raw values. For you, you need the values after constraints, so use the second kind.

• Thanks! This and the other answer work perfectly, thank you so much ^^ May 11, 2022 at 8:12

I think I understand what you mean now:

You want to influence the light/shadows with the angle of the sun and additionally with a gizmo, but at the same time include the rotation of the head, right?

If I'm right, then you would actually only have to additionally capture the rotation of the head.

You can solve it this way or something similar:

I just created an additional driver here that captures the rotation of the head.

But since the orientation is different here, you use the X-axis instead of the Z-axis.

• Sorry, I forgot to pack the files. Updated the link, should have the materials now. And the method above doesn't work, I need the rotation value of the constrained empty, any ideas? May 10, 2022 at 10:44
• Thanks so much! Your answer and the other one here both work perfectly ^^ May 11, 2022 at 8:13