A Quick Vector Math Question

Hi! Simple vector problem I’m having trouble with. Any help would be most appreciated:

I’d like to align a mesh in my scene with the normal of a plane in my scene. The end result would have the mesh’s up vector = the plane’s normal, so that is the mesh were resting on the plane, “up” would appear to be the same for both.

I’ve got the plane’s normal vector, and of course I’ve got access to the mesh’s transform and eulerAngles, but I don’t know how to manipulate the transform so that Transform.up == the plane normal vector.

It’s my inexperience with vector math (which I am working to improve) but I could some help with this one, if you have time.

Thanks for any help!
Orion

transform.up is settable. Just use an equals sign.

Oh! Hahaha, that was easy. I had assumed it was only readable, but I guess that’s what happens when you assume. Thanks!

Really?! Apparently yes… Here’s the getter,setter:

public Vector3 up
    {
        get
        {
            return (Vector3) (this.rotation * Vector3.up);
        }
        set
        {
            this.rotation = Quaternion.FromToRotation(Vector3.up, value);
        }
    }

Many times I have written that line myself not knowing I could use this handy shortcut. Neat.