Aligning an object's rotation direction to a vector

How do you align an object's rotation direction to a vector?

transform.rotation = Quaternion.LookRotation(directionVector);

To rotate an object to face a desired orientation, perform the following on LateUpdate():

transform.Rotate(Vector3.right/up/forward, float);

ex:

void LateDraw()
{
this.transform.Rotate(Vector3.up, 90);
}

this will set the rotation each frame to whatever you need it to be. The example illustrates a 90˚ since that’s the rotation offset of most imports…

I’m quite new to this, but this is what worked for me:

void Update() {
    Transform.rotation = Quaternion.LookRotation(new Vector3(-directionVector.x, directionVector.y, -directionVector.z));
    Transform.Rotate(new Vector3(1, 0, 0), 90);
    Transform.Rotate(new Vector3(0, 1, 0), 180, Space.World);
    Transform.Rotate(new Vector3(0, 0, 1), 180);
}

Hope this helps :slight_smile: