You can cast a ray in a specific direction like this:
var hit : RaycastHit;
var ray : Ray = Ray(gameObject.transform.position, Vector3.forward);
if(Physics.Raycast(ray, hit, 10))
{
Debug.Log(hit.distance);
Debug.DrawLine(ray.origin, hit.point);
}
Vector3.forward could be any Vector direction you wish.