check angle range

I wondering if there was a way to check raycasting on a range of angles.

in context:

this code is how i am currently checking if my character is colliding with a nearby wall.

distf = transform.TransformDirection (Vector3.forward);
if (Physics.Raycast (transform.position, distf, 2))
{
canmoveforward = false; 
}
else
{
canmoveforward = true;
}

what i want to do is check a range of angles (ie 0 - 89 degrees) to see if the path is clear for my character instead of just checking the front back and side.

Unfortunately, there’s no easy way of ‘sweeping’ a raycast test, other than just shooting off several individual rays in different directions. It depends on how accurate you want your sweep to be. I would write some kind of function that returns an array of RaycastHits, given an angle, a centre direction, a normal and an integer determining how many rays should be cast.