Need Help with RayCast. No Vector?

I’m testing some script, and I’ve noticed in scene view, the ray will not cast out from the camera all the time. There some extra stuff in my code that doesn’t get executed, because the ray no longer hits the object. It seems to stop shooting out a vector.

void Update() {
   Vector3 fwd = transform.TransformDirection(Vector3.forward);
   if (Physics.Raycast(transform.position, fwd, out hit, 100))
   {
      Debug.DrawLine(transform.position, hit.point, Color.blue);
      if (hit.collider.gameObject.tag == "object") 
      {
         // Do stuff here
         Debug.DrawLine(transform.position, hit.point, Color.red);
      }
   }
}

I attached a picture of the scene view so you can see what I’m talking about. The line is blue while its being cast out and hitting random objects. But when I hit the cube, with the tag ‘object’, it turns red UNLESS I’m right up on the cube. Once I approach the cube too close, it stops everything. It’s simple script, I’m not seeing why it’s not working.

Thanks. That line of code helped me track down the problem on what it was hitting.