How to make driver to stimulate "motion sensor light"?

So i wanna create this scene : numerous lights but off, and an empty box. When the box passes the lights, it will turn on. I illustrated this with a keyframe below :

is there a way to use drivers? Using keyframes for each lamp seem painful, since im planning to put 20 lights in a row like this. I wanna try using drivers so i just animate the empty box from start to end.

Im having no idea how to use drivers though (still trying to watch drivers tutorials online), so i hope i can get enlightenment how to produce this.

here is the blend file :
driver motion sensor.blend (121.0 KB)

In this simple case, I’d do it the following way:

  1. Have every light be a separate object with the same material
  2. set the origin of each object to the center of the geometry
  3. Apply the scale of both the objects and the empty (!!)
  4. Use this kind of shader setup:

The idea is to compute the distance of the object to the empty in y-direction and switch on the light as soon as the empty is past the object.

driver motion sensor_shader.blend (115.9 KB)

For more complicated setups, you may want to read this thread here:

1 Like

wait what? I got mindblown. using no driver at all and it…works… Thank you for your kind response! Btw, how to customize the brightness? like, i want the lights max at 35. From the nodes, seems like i cant adjust the brightness yet.

im gonna check the complicated setup post right now.

EDIT : just checked the complicated post, it seems work, i could adjust the brightness as well. Geometry nodes felt so alien to me though…