Align object by 1 face normal to world axis

I have an object that is a single face that is frozen in a randomly rotated position that does not align with any world axis.

I have managed to find the face normal vector and position a mesh line primitive to visualize the face normal.

I need to now calculate the difference between the face normal and world Z so I can rotate the face so its normal points up in world z and then I want to instance the object on points created by Distribute Points On Faces on another object.

test align normal to world axis.blend (134.3 KB)



solution part 2: Align object by 1 face normal to world axis - #4 by stray

Align Rotation should return the rotation to selected Object axis if you just plug Vector into it :thinking:
Like so:

I can’t figure out how to make it apply to a collection of objects.

The plan was to use geometry nodes to straighten out all of the source objects and then instance them on points on the sphere.

It works when there is only 1 object in the source include collection, but as I add more objects to the source, the rotation fix doesn’t get applied to them. How to fix the rotation on each thing in the collection instead of needing to put a Geometry Node modifier on each individual object?

test align normal to world axis.blend (140.7 KB)

You can try:
Input Instance in For Each node > set For Each: Instance > Realize Instances > rotate the face (apply you “align” node group) > Geometry to Instance > go to “For Each” exit.
The lower “For Each” geometry output should contain a collection of rotated instances, that you should be able to use as usual in Instance on Point.

Thanks

test align normal to world axis.blend (144.7 KB)