Does ScreenPointToRay need a Direction?

I’m guessing this should be in Unity Answers but I just thought it would be better here. I want to ask the question: Does ScreenPointToRay need a Direction because Ray needs an origin and a direction but I’m sure I’m only defining the position here with ScreenPointToRay. I’m guessing it handles the direction automatically since the main camera can only be facing one way or something. Am I right or what do you know?:smile:

var ray : Ray = Camera.main.ScreenPointToRay(Vector3 (Screen.width * 0.5, 
			Screen.height * 0.5, 0));

From the doc:

Returns a ray going from camera through a screen point.

Resulting ray is in world space, starting on the near plane of the camera and going through position’s (x,y) pixel coordinates on the screen (position.z is ignored).

http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenPointToRay.html

The direction is always “away” from the camera or the direction the camera is facing in other terms.

Oh, ok! Thanks, I should have read that!