RayCast doesn't work at all

I’m shooting a ray from a point in space to the position point of an object. When the ray collides with the collider - there should be a reaction, but there is none. I tried playing around with the values, but it doesn’t seem to work.

public IEnumerator Scan(){
   for(int i = 0; i <= 180; i++){
    origin = new Vector3(Mathf.Cos(i * (Mathf.PI/180f)),0f,Mathf.Sin(i *(Mathf.PI/180f)));
    	for(int x = 0; x <= density; x++){
    	quat = Quaternion.Euler(x,0,0);
    	sphere[x].transform.localPosition = quat*origin;
    	Debug.DrawLine(sphere[x].transform.position, sphere[x].transform.parent.position, Color.red, 0.02f);
        if(Physics.Raycast(sphere[x].transform.position, sphere[x].transform.parent.position, out hit) && hit.collider.gameObject.name != null){
    	  Debug.Log("all is good");
    	}	
    	   }
             yield return new WaitForSeconds (0.01f);
    }
}

I have added this line of code into Update(). Still no reaction… Maybe something is wrong with the object? The object is a cube with a box collider and rigidbody.

Debug.DrawLine(new Vector3(2,0,0), new Vector3(0,0,0), Color.red);
		if(Physics.Raycast(new Vector3(2,0,0), new Vector3(0,0,0), out hit)){
							if(hit.collider.gameObject != null){
								Debug.Log("all is good");
							}
			}

The second parameter of Physics.Raycast is not the target position but the direction toward the target position. This may work:

Vector3 heading = sphere[x].transform.parent.position - sphere[x].transform.position;
float distance = heading.magnitude;
Vector3 direction = heading / distance;

if(Physics.Raycast(sphere[x].transform.position, direction, out hit) && hit.collider.gameObject.name != null){
	Debug.Log(hit.collider.gameObject.name);
}

I thought direction means a point in space, if I have origin (2,0,0), then the direction (0,0,0) means not that the ray is shooting at that point, but it’s length. I’m really confused, how do I make this code work then, so that the ray would shoot the same way the line does?..