Rotate so VectorY points to another Vector3

I have point A and B, on a 2d plane(X,Y), when I’m at pointA I need to rotate my camera so it’s localY axis points towards point B, once that’s done I move the camera to pointB, when I reach pointB I’ll need to rotate the camera back to face pointA (Yaxis pointing towards A). How can I get this correct angle?

http://imgur.com/8TyKAx2

C#

public Transform Player;

Vector3 Point;

public Transform A;

public Transform B;

void Update()
{

if(transform.position != A.position && Player.poition == A.position)
{
     Point = B.position;
 }
else if(transform.poition != B.position && Player.position == B.position)
{
    Point = A.position;
}

transform.LookAt(Point);

transform.position = Vector3.Lerp(transform.position, Point.position, /* SomeTimeValue */);

}

tell me if this doesnt work :slight_smile:

Vector 3 direcao = (new Vector3(nextNode.GetCoordinate().x,nextNode.GetCoordinate().y, myCamera.transform.position.z) - myCamera.transform.position).normalized;
myCamera.transform.up = direcao;

Here’s the solution for it.