Collision not working as intended

Hi everyone and thanks for taking the time to read my question and helping me out.

So I am programming a horror game at the moment and currently working on the chasing mechanic of the enemy. I’ll describe my vision of how it is supposed to work:

  • Enemy roaming freely through the map (working)
  • When Player is within enemy detection range & sprinting enemy starts chasing after the Player
  • Enemy stops chasing when player out of range, player in safe zone or caught the player.

Problems I am facing right now and need help with:

Currently - and that’s my biggest problem - the enemies detection range for triggering the chase is a Sphere Collider + a certain speed. The chasing sequence only successfully triggers when the Player sprints through the outer barrier of the Enemy, but it doesn’t trigger when the player is inside of the sphere and starts sprinting. For Context: My Enemy is going to be really tall in a forest setting. So it might be hard to recognize him early enough to not be in his detection range already.

Second Problem is:
Sometimes when the chase actually does decide to trigger within the Sphere Collider, it seems it only does it in one specific direction of the enemy. His left side. It doesn’t even always do it, but sometimes I am upclose running around him with no effect whatsoever, just the enemy in his freeroam. And some other times I am well within his radius and it triggers the chase once i start sprinting - but only from his left side, which doesn’t even make any sense to me at all.

Best thing about all this: I tried debugging all of the single steps with console outputs via print string, and every single step works.

Maybe I am missing something essential and thats why my collider is so picky about when to throw a chase or not? And doesn’t recognize the player sprinting inside the collider?

I am very grateful for any kind of help or ideas.

Best regards everyone.

1 Like

You might be better off using the AI sense, which is specifically made for this?

1 Like

This is awesome and thank you for this video, yet I have more of a sound detection thing going on. Or at least i am trying to simulate it.

My enemy is blind, so I need it to have 360° spacial awareness within a certain radius. That’s why I went for the Sphere Collider Thing.

1 Like

There is a hearing version

I re-read your post, it does sound a bit like a coding issue :thinking: I mean, an overlap is an overlap. Hard to say without details.