CLick on terrain and record vector3 location I clicked at?

I need to click the terrain and know the location which i clicked at in order to tell a unity to go to that location. how do I click the terrain and retrieve at which location I clicked? should I use a raycast and collision or what? HELP!

Use a ray, e.g.

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100)) 
{
  Debug.DrawLine (ray.origin, hit.point);
}

Docs here.

Send a ray cast from mouse position then you can get all the information you need from the raycast hit

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100)) {
    var hitPoint = hit.point;
}

doc

var clickPoint : Vector3;

function Update()

{

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);

var hit : RaycastHit;

if (Physics.Raycast (ray, hit, 100) && Input.GetButton("Fire1")) 

{

	Debug.DrawLine (ray.origin, hit.point,Color.red);

	clickPoint = hit.point;

}