Hey guys(or gals), I’m in the making of an AI for an FPS type game and i’m looking for a way to make detection system in the AI, what i’m doing now is this.
For the basic eye sight:
-
overlap sphere, radius depends on the AI state and unit stats
-
raycast to target to check if anything is in the way. raycast starts from right infront of the unit so if the target is at the back it won’t “see” it.
I’m thinking about tearing this whole thing out as i’m not too happy with it and replacing it with cameras on the units and checking if X is visible, I think it will be a lot more accurate & cheaper than the current solution, but I haven’t done this before, any thoughts?
also if you know a good guide for this I’ll be happy for a link.
For detecting when being attacked i’m quite stuck.
right now when the player shoots an enemy I tell that enemy to go look where the shot came from and when the player get in range it’s all good, but that happens only when the player hits the enemy.
I thought about doing an overlap sphere where the shot hit and alerting everything that needs alerting, and i suppose it will work just fine for my “main” gun that shoots at a very slow interval, but when it come to automatic guns i think the physics calculations are gonna be insane(haven’t tried this).
also, what if the shot passes right near a units head but doesn’t hit anywhere close to it, it still needs to detect that, any help on addressing this problem?
didn’t want to add code as this post is long enough as it is, if you find it necessary say so and i’ll post the relevant code, thank you very much for reading this. ![]()