Raycasting how to find position on end of ray float distance

Ray ray = gameObject.camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, 5/Float Distance/)){
transform.position = /vector 3 ( position at end of ray distance )/
}

let say between me and float distance lies box if I would look at box I would get position

vector 3 (0,0,1)

I would achieve that with this code

Ray ray = Player.camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit; // declare the RaycastHit variable
if (Physics.Raycast(ray,out hit)) {
	transform.position = hit.point
}

hit point would be vector 3 (0,0,1)

but if that box is still there I want to find the vector 3 (0,0,5) so it would go through box and on float distance would stop and look it’s position

I hope I explained well what I need

if not I’ll need to make a picture

done on request
[8390-for+unity+ask+a+question.jpg|8390]

Check my answer here : Attach 3D object to mouse - Questions & Answers - Unity Discussions

If you don’t have a collider to raycast against for depth reference, but you know the distance from the camera you would like the point to be, you can use Ray : Unity - Scripting API: Ray

#pragma strict

public var distance : float = 1.5;

function Update() 
{
	CastRayToWorld();
}

function CastRayToWorld() 
{
	var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	var point : Vector3 = ray.origin + (ray.direction * distance);

    Debug.Log( "World point " + point );
    Debug.DrawLine( Camera.main.transform.position, point, Color.red );
}

Distance is distance from the camera that the ray is to terminate, play with this value. The Debug.DrawLine should show where this point is in world space.