# Material Color from Rotation Angle

I basically have a two-part hinged lever. One arm is fixed, and the other arm can rotate in Y 0 to -45 degrees (X and Z are constrained to 0). So it's rigid body active -> hinge -> rigid body passive. And I want to put a 'signal light' on the passive arm which will change between two colors when then active arm has been rotated more than x degrees. It's like a "Warning, arm is out of rest position" signal.

So I made a material, colored it with a color ramp with my two colors. And it takes a value set by a driver that watches rotation_euler[1] on the active arm. There are also some math nodes in there to get things into the range I want. And this works fine in the 3d viewport when I manually rotate the active arm - the color changes when the active arm has rotated to the range I'm watching for.

But it doesn't work in the animation, or when rendered. The active arm moves when it's pushed by the thing that's supposed to push it (just a falling object, for now), but the color of the indicator never changes. It looks like the rotation_euler[1] value doesn't change.

If I look at the value in the Python console:

>>>bpy.data.objects['Lower Arm'].rotation_euler

Euler((0.0, 0.0, 3.1415927410125732), 'XYZ')

But that output never changes, regardless of which frame I stop the animation on. (The 180d rotation in Z is expected).

Any ideas? Is this not a valid way to watch rotation?

(2.93.5, Win10)

• Might not be it, but I noticed that if the object's angle display mode in its transform properties is set to Quaternion or Axis Angle, the euler angle never gets updated with changes. And conversely Nov 2, 2021 at 14:37
• i think one sketch would help here much more than 1000 words ... ;) Nov 2, 2021 at 14:37
• so you can use rotation_axis_angle or rotation_quaternion instead of rotation_euler Nov 2, 2021 at 14:39
• The object's transform properties show "XYZ Euler" mode. Nov 2, 2021 at 14:52
• Here's the .blend: ok-cleek.com/stuff/newarm.blend !https://ok-cleek.com/stuff/newarm.png. Nov 2, 2021 at 15:00