I'm attempting to add gun turret style tracking to objects that have been placed onto the polygons of another object using Animation Nodes 2.1. I'm currently attempting this with blender's built in constraints system, but that has not worked, which I'll detail later.
My setup consists of 5 objects, 1 object which has its polygons & polygon normals used to place the 3 next objects; the 2nd object is the static "base" of the turret; the 3rd object is the yaw aspect of the turret, which should only rotate around its local z axis, with the other 2 axes being locked; the the 4th object is the pitch aspect of the turret (the barrel, in this case a scaled cube), which should only rotate along its y axis (between -180° and 0°) and have the same z rotation as the yaw aspect, with only the x axis locked; the 5th object is an empty, to be tracked.
The pitch and yaw objects both have constraints set so that they'll track the empty with their appropriate axes locked, as described above. On their own, before animation nodes is involved, they track the empty as expected.
When I instantiate the appropriate number of objects, and place them on the polygons with Animation Nodes however, each instantiated object seems to lose the rotation of the polygon they're on. They do track the empty, but will rotate rotate around these incorrect local axes. I suspect that this may be because the constraints' transformations may apply before animation nodes' transformations apply.
Is there any way to work around this issue, or would it be possible to altogether avoid using blender's built in constraints system and instead simulate the effect entirely in animation nodes? The latter option seems that it'd be more flexible, however I do not know how to replicate the effect of blender's constraints in animation nodes while also maintaining the position on the objects on their polygons.