Hi,
I have a capsule(the NPC body) with a cone mesh attached(their sight). This sight cone has attached a trigger collider and a kinematic rigidbody. This NPC is patrolling, so he walks and looks around. The problem is that I’m using another capsule(the player), which has both a collider(not trigger) and a kinematic rigidbody, to test the NPC sight(basically, I’m moving this character so to enter the field of view of the NPC), but OnTriggerEnter/Exit on the sight cone on the NPC is called unexpectedly: when the player capsule enters the trigger mesh of the NPC, suddenly onTriggerEnter
and onTriggerExit
get called twice each(and yes, in both onTriggerEnter
and onTriggerExit
i check that the object entering/leaving is the player collider). The same thing happens when the player collider leaves the trigger mesh of the NPC, onTriggerEnter
and onTriggerExit
get called twice each.
To make things a bit clearer, this appears in the Console:
Player Entering
Player Entering
Player Leaving
Player Leaving
Does anybody have any idea about what’s going on here?