Hi, I have a list of points in the 3D space that represents the vertices of a polygon (points are ordered). The points are coplanar, but they are in an arbitrary plane. I need to align these points so that they are on plane xy of the world. I want to remove the 3rd dimension, but I cant just project them removing the z axis because I want to keep the angles and distances between the points).

I thought I would be able to do it in a simple way, but I’m not having the result I intended. What I did:

I transladed the points of my polygon to the origin subtracting the first point (vertices[0]) from all other points, then used other two points of my list of points to estimate the plane normal using:

`Vector3 A = vertices[1]; Vector3 B = vertices[2]; Vector3 planeNormal = Vector3.Cross(A, B) / Vector3.Magnitude(Vector3.Cross(A, B))`

then, with this normal, I intended to align it with the world z-axis.

I created some spheres inside a gameObject (objectSpheres) with my vertices, and I set the local axis of the object in the same direction of the plane normal (example image 1):

`objSpheres.transform.rotation = Quaternion.LookRotation(planeNormal);`

and by pausing the Unity game scene, I can select objSpheres and go to the Inspector and set the local angles in Transform Rotation x,y and z to zero, and then my spheres are aligned. That’s the result I want, I can see my spheres aligned with the plane (example image 2).

But when I try to set these values by code with

`objSpheres.transform.localEulerAngles = new Vector3(0, 0, 0);`

it doesnt work at all, looks like I only transform the objSpheres axis, but the other spheres do not move (example image 3).

What am I doing wrong?