title: Unity3D RayCasting in 4 directions only
body: <p>I am trying to create a maze game where the player can move only when it can see a sweet. </p>
  
  <p>Currently the raycast is searching in every direction (360 degrees) <strong>But I only want the raycast to look directly Up,Left,Down,Right (instead of 360 degrees)</strong>... This way the player can only move when a sweet is placed in direct line of sight. </p>
  
  <pre><code>public function setTargetSweet(target:GameObject)
  {
      too = target.transform.position;
      targetSweet = target;
  
      var fwd = too - transform.position;
  
      Debug.Log("Setting target sweet: " + target.name);
      Debug.DrawRay(transform.position, fwd, Color.red, 5f);
  
      Physics.Raycast (transform.position, fwd, hit);
  
      if ( hit.collider.tag == "MoveToSweet") {
          print ("Can See Sweet");
          gotoSweet = true;
      }
      else
      {
          Debug.Log(hit.collider.name);
          Debug.Log(hit.collider.tag);
          gotoSweet = false;
      }
  }
  </code></pre>