# How to rotate instanced objects on Z-axis using geometry nodes to match face rotation

I've got a mesh with two separate faces that each have a cube on them. I would like the cube attached to a specific face to rotate to match the face as that face rotates. I'm pretty new at geometry nodes so I might be misunderstanding this, but I believe the issue is that the Z-axis has no reference point for a face as it rotates. (See image of monkey heads as explained in https://www.youtube.com/watch?v=Fl-igAAMCeM.

In the image below you can see that I have two faces in one object. I want to rotate the face on the right by 45 degrees (or however much is necessary) so that the edges of the cube rotate with the edges of the face. As is shown the cube itself doesn't rotate as is the goal.

One other concern is that I would sometimes like to do rotations up to 180 degrees when I need to display the opposite side of the cube. In this instance, the "largest-y" edge would become the "smallest-y", so doing it based on vertex position hasn't given me much success when trying to perform face tangents based on edge position.

After many trials, I've reverted to the following geometry nodes, just for simplicity's sake of this post.

As a final note, X and Y rotate just fine, it's purely the Z axis that I need help with. I do have a workaround but that involves creating copies of the object, and I'd prefer to keep them all as the same object, but with multiple faces.

Thank you so much in advance and let me know if I need to send any more info. Also, I looked through dozens of "similar" questions but I may have still missed something. Sorry if that's the case.

• I think this helps: blender.stackexchange.com/a/277891/60486 Commented Dec 7, 2023 at 22:01
• This one worked partially, but as soon as I add another plane to the object, the Z rotations become distored due to positioning. I'll have to see if I can figure out more with it. Commented Dec 8, 2023 at 7:39