Aligning to a orthogonal basis

Hi,

I’m experimenting with orientations and alignments of objects and I have this problem.
I have a triangle (mathematical, not a GameObject) and I want to attach an object to it. For that I calculate the normal of the triangle ant then 2 perpendicular vectors to it that form an orthogonal basis.
To orientate an object to that basis, I mean, to make the position and orientation of an object to be the same as the basis i need to load the row (or column) matrix of that basis into an object transformation. Is it possibly, in Unity, to load a specific matrix into an object transform?
Thanks in advance

I don’t see easy API for that, no.

But you can roll your own matrix → quaternion conversion and create a proper xyzw Quaternion from that.

google for “matrix to quaternion” seems to give the most results.

on second thought:

will give you a good rotation if also given an up vector that works for you.

Thanks for the help Troy, SetLookRotation works like a charm :slight_smile: