# What does Quaternion.Lookrotation do?

I have this code,

if(Physics.Raycast(camRay,out floorHit,camRayLength,floorMask))
{
Vector3 playerToMouse = floorHit.point-transform.position;
playerToMouse.y=0f;
Quaternion newRotation = Quaternion.LookRotation(playerToMouse);

playerRigidbody.MoveRotation(newRotation);
}


What happens when I use playerToMouse = floorHit.point,instead of playerToMouse = floorHit.point-transform.position.

Quaternion.LookRotation() turns a direction vector into a quaternion (by "looking" along that direction)

floorHit.point-transform.position determines the direction vector between the hit position and the object's position, versus floorHit.point is simply a position. Specifically, subtracting one position from another gets the direction vector between those positions.

• is that looking at the point like (0,0,0,0).I am ray casting the ray on the floor..I have seen in an example(Unite day 2014 training) they are using playerToMouse = floorHit.point-transform.position...Y should i need to subtract the vectors..I can use floorhit.point alone know...what is the difference Sep 15 '14 at 18:31
• I explained what the difference is: one is a position, one is a direction Sep 15 '14 at 18:41