RaycastHit target;
float raydistance = 50;
Debug.DrawRay(beamorigin.position, transform.forward*raydistance, Color.yellow);
if (Physics.Raycast(beamorigin.position, transform.forward*raydistance, out target, raydistance, targetlayer))
{
Debug.Log(target.collider.tag);
}