Rotate one vector to another

I have a static mesh that I am instancing to different positions with different orientations. The static mesh’s up vector is (0, 0, 1) and I want to rotate the static mesh so that the up vector is now my arbitrary vector V.

I have tried using V.ToOrientationRotator() but the static mesh is not rotated correctly. I can’t seem to figure out the maths in my head to do this and there are so many vector → rotator functions that surely one of these will do what I want.

I figured it out, if I set my rotator to be the following it worked:

FRotator Rotation = V.ToOrientationRotator() - FVector::UpVector.ToOrientationRotator();

I guess what this is doing is rotating the static mesh so that its up vector is now forward then rotating the object by the orientation rotator of V.