title: My Raycast hit the object behind the collider
body: <p>So I'm making an FPS game on Unity. I have an enemy object with a box collider and rigid body, and I turn on the isTrigger on Box Collider. However, I don't know why but I couldn't shoot the enemy. The Raycast hit always hit the object behind of the enemy. But, when I turn off the isTrigger on the enemy Box Collider, I could hit the object, but the movement is so weird. Could anyone help me how to make the Raycast could hit a trigger box collider? Thank you so much</p>
  
  <p>Raycast Code</p>
  
  <pre><code>void BulletFired() {
          RaycastHit hit;
          print("shoot");
          if (Physics.Raycast(mainCam.transform.position, mainCam.transform.forward, out hit)) {
              print(hit.transform.gameObject.name);
              if (hit.transform.tag == Tags.ENEMY_TAG) {
                  print(hit.transform.tag);
                  hit.transform.GetComponent&lt;HealthScript&gt;().ApplyDamage(damage);
              }
          }
      }
  </code></pre>