Collisions with a character controller

Hello everyone.

I’m trying to make a simple sidescrolling shooter game.

The main character is controlled with a character controller and the enemy’s bullets are in a box trigger collider. That’s the code I’m using, wich is placed in the bullets:

function OnTriggerStay (other : Collider) {
if(other.gameObject.CompareTag("Player")){Destroy(other.gameObject);}
} 

The script seems to work fine, but only when the main character is moving, when he’s staying still, the collision doesn’t seem to work fine. What I am doing wrong?

Thank you

As Owen says, the collision only happens because the Character Controller “ran into” the static bullet collider. A collider without a rigid body, Unity assumes is static. So Unity doesn’t check to see if it moves into another collider.

But Unity still tests to see if any objects have moved into it hence it does detect the character controller moves into the trigger. The easiest solution is to put a kinematic rigid body on the bullet.