how to get info on what raycast hitted

Basically, I wanted to determine whether there is any obstacle between Player and Target.
And then return the target info.
I tried to use Raycast, but feel free to offer alternative if you can provide one.

I managed to get the Raycast line stopped at where the collider is.
But I don’t know how to get the variables from the object which the collider is attached to.

Also, is there anyway to widen the ray? In case the player might not be able to pass through gap between objects.

Code so far:

public Transform Player;
public Transform TargetLocationFinal;

	void DrawRayCast()
	{
		RaycastHit hit = new RaycastHit();
		
		Vector3 direction = TargetLocationFinal.transform.position - Player.transform.position;
		
		if (Physics.Raycast(Player.transform.position, direction , out hit))
		{
		    Debug.DrawLine (Player.transform.position, hit.point);
		}
	}

All the information is in your RaycastHit. you have access to the collider, and from there everything with GetComponent.

You can’t widen the ray, but you can cast several by spacing them of transform.right, left, up etc.