Get Colliders from ray casting through 2 predefined points

Hello Everyone,

Im in the middle of a problem that is taking me some time. Im currently developing a 2d topview game.

I`ve predefined 2 points of a line by using raycasthit to know when user set mouse down and up. Now my mind is blank to what can I do to raycast a line( as i have already done with line renderer ) to get all objects that collides with the line.

I thougth of using some objects with collider and instantiate within the line, but it`s not a satisfactory resolution.

Here is the code part that I`ve writed.

		float distance = Vector3.Distance(initPos,finalPos);
		RaycastHit hi;
		Ray ra = new Ray(initPos,finalPos);
		if (Physics.Raycast (ra, out hi,distance)){

			if(hi.collider.tag=="Enemy"){
				Destroy(hi.collider.gameObject);
			}
		}

Thanks for reading this, now please help me! ^^

RaycastAll

Thanks LeftyRighty.

Is there a way of using RaycastAll with line cast? Only got it working with linecast, but it`s only getting first collider.

Already got it, thanks.

Just verified if theres still a collider in the line cast, if true, linecast it again, if false, do nothing; I just dont it is very process saving.