[SOLVED] How to automatically angle pistons?

Not sure if this is the right subforum, but here’s my question:

My scene includes a piston, with a setup resembling this:

The red and blue objects can reposition freely along the X and Y axis, and when they do, I want the yellow and green sides of the piston (which are children of red and blue, respectively) to automatically rotate so that they face each other. Thus, the piston will contract and expand as red & blue move closer and further away. What’s the simplest way to do this?


Check out the locked track constraint. They will both need a constraint tracking the other.

That worked! Thanks!