Rotation and ray, problem.

Hello, I have 2 problems that I would be greatfull if someone could help me with.

  1. I have tried to found a way to rotate an object so that it has it’s y-axis is pointing at the vector3 that i get out of my ray. (ray.direction)

2.The ray is currently starting from the camera and going through the mouse, but I want the ray to go from the object to the mouse.

summation-I want the object to point where the mouse is.
Here’s what I’ve done myself, sadly it doesn’t work very well :?

var ray;
//Problem 2.
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
//Problem 1.
transform.LookAt(Vector3.up,Vector3(ray.direction.x,ray.direction.y,0));

Please post an answer if you know what I should do.

PS. this is supposed to be in a 2d game on the y-axis and the x-axis.

being a retard and posting 3 topics doesnt make me want to help you, and as a result im not going to.

Well, I didn’t mean to post 3 topics at once, But , thank you for notifying me. I’ve deleted the other 2 now.
If anyone else have any idea of what i should do to solve this problem. Please. let me know.