4 ms·
>trying to calculate if enemy can see you Send a raytrace from the bot to the player and see if it hits something other than the player, which is just one line
by jimmaswell 12y ago
>trying to calculate if enemy can see you
Send a raytrace from the bot to the player and see if it hits something other than the player, which is just one line
Pathtaking beyond simply moving towards the player is a lot harder, yeah.
- ajuc 12y agoIf you just send 1 ray from eye towards the center of the enemy (or head, or whatever) - and this particular part of the body is occluded by a wall or a chair, but the rest isn't - the result will be wrong. You can accept that, use many rays, or do proper view frustum/body model(simplified probably) intersection, after cutting the view frustum with the terrain. You can also consider lighting (so enemy can't see you hiding in a dark corner), or even dynamic lighting (and give enemies light sources). Everything becomes hard after you think about it enough :) But I agree simple solutions + some tinkering with parameters works most of the time (and gamers probably won't notice).