Moving Lights Tracking A Target

481 views
Skip to first unread message

Mathieu

unread,
Jul 5, 2015, 8:19:35 PM7/5/15
to ligh...@googlegroups.com
Here's a sample project showing how to make moving lights track a target. The moving lights are assumed to be hanged upside down at the ceiling level. The target is moving at the floor level.

There are 26 Martin Mac 101 positioned along the sides of a rectangle. 

The target moves continuously using a random pattern. Its position is put in global memory using the gmem functions. So grecall(0) gives you the X position in percent and grecall(1) gives you the Y position in percent. 

With the help of the shader mode, you only need two sources to do the tracking. For the pan, the formula is:

motor.pan(math.angleBetween(px,py, grecall(0),grecall(1)), 540)

Explanations:

math.angleBetween(px,py, grecall(0),grecall(1)): compute the shortest angle in degrees between two points, in this case, between the position of the moving light and the position of the target.

motor.pan(..., 540): compute the proper pan position to reach the desired angle in degrees computed by the math.angleBetween function. The 540 is the maximum pan supported by the Mac 101. The motor.pan function uses this max pan info to optimize the returned positions.


For the tilt, the formula is:

scale(-math.elevationAngle(px,py,10, grecall(0),grecall(1), 0), -30, 210, 0, 100)

Explanations:

-math.elevationAngle(px,py,10, grecall(0),grecall(1), 0): compute the elevation angle in degrees between the moving light and the target (this is in 3D). (px, py, 10) is the 3D coordinate of the moving light, with 10 being the Z position. In other words, 10 is the height of the ceiling and is relative to 100 since we're working in percent. Adjust it to fit your setup. Since the angle is negative when looking down, we invert the result with -.

scale(..., -30, 210, 0, 100): map the angle returned by math.elevationAngle to fit the moving light tilt attribute. The Mac 101 has a 240 degrees tilt. 50% makes the moving light point directly down at 90 degrees. So if we subtract 120 degrees (50% of 240) to 90, we get -30 and if we add 120 to 90, we get 210. 

---

Depending on your moving lights, you'll need to adjust the max pan (the 540 in the example) and the mapping for the tilt (the -30 and 210 in the example). If you have multiple moving lights with different max pan & tilt, you should consider creating multiple pan & tilt grids, one per moving light type, to keep things simple.
moving-light-ceiling-position-tracker.ljp
Reply all
Reply to author
Forward
0 new messages