OnTriggerEnter problem in child collider

Hi All,

I have an enemy that has a character controller component that moves the enemy and an empty game object that has shpere collider and isTrigger in enabled. The empty game object is child of the enemy game object. So basically I have a game object that has 2 collider - tha “main” (in hierarchy sense) and a child sphere collider.

I attached a script to this enemy game object and override the OnTriggerEnter method. But it seems that nothing happens when other game objects enters this sphere…all other game objects are rigid bodies that have collider attached to them.

please help me I’m going crazy here… :slight_smile:

Thank u in advance

The problem here is that you are moving around an object that thinks it is a static collider. Because that object doesn’t check for collision when it enters another object, it has to rely on other objects striking it- however, if it is already overlapping another object, the OnTriggerEnter function won’t get called! Try putting a kinematic rigidbody on the empty with the sphere trigger. That way, it will make sure that it updates properly with physics.

Just checking, the script that checks for triggers is on the same gameObject as the collider, yes?