title: How to create a new ray with the help of a cycle and constantly change its direction?
body: <p>There is a code -</p>
  
  <pre class="lang-c# prettyprint-override"><code>Vector3 rayDirection = new Vector3(Random.Range(-Spread, Spread), Random.Range(-Spread, Spread), 0);
  Ray ray = new Ray(BulletSpawn.position, BulletSpawn.forward + rayDirection);
  RaycastHit raycastHit;
  RaycastHit checkHit;
  Distance = MaxDistance;
  for(float distance = MaxDistance; distance &gt; 0; distance -= 20)
  {
      if (Physics.Raycast(BulletSpawn.transform.position, BulletSpawn.forward + rayDirection, out raycastHit, Distance))
      {
          PrintDecal(raycastHit);
          Distance -= 20;
  
          rayDirection = new Vector3(Random.Range(-WoodSpread, WoodSpread), Random.Range(-WoodSpread, WoodSpread), 0); 
          Ray checkRay = new Ray(raycastHit.point + ray.direction * 1.2F, -BulletSpawn.forward);
          if (Physics.Raycast(checkRay, out checkHit, 3))
          {
              PrintDecal(checkHit);
          }
      }       
  }
  </code></pre>
  
  <p>Is it possible to do it was like in the -
  <a href="https://i.stack.imgur.com/H5HO4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H5HO4.png" alt="image"></a></p>
  
  <p>That is, when hit, the next ray was created with a random direction from the point checkHit (point of departure of the conditional bullet). How this implement without creating five methods for each ray, but that all will be in one method be. Is it possible?</p>