2
\$\begingroup\$

I have 4 points as Vector3 in 3D space that shape a plane. How can I calculate the plane normal direction these four points create together, and express it as a Quaternion?

Guide Image

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

First, we'll average together the vertical and horizontal edges of your quad to get two vectors, pointing in the directions of the x and y axes of the transform gizmo in your diagram:

var x = C - A + D - B;
var y = C - D + A - B;

The z direction is then

var z = Vector3.Cross(x, y);

We can turn this into a quaternion using:

var planeOrientation = Quaternion.LookRotation(z, y);
\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.