How can i calculate line of sight of a monster?
Hi all,
I m developing a first person shooting game. i have done all
the handling of PC but the problem is with the NPC handling.
My game monsters attack continuosly without deciding whether
the PC is in Line Of Sight or behind an obstacle wall etc.
At that time i have no idea how to calculate the Line of
Sight of the Monster. So i need help.
Thanks
what about making a view frustum inforont of the monster and test for a collision between the player and the monster''s view frustm to test for monster if he is seeing the player or not?
That''s an off-topic for this forum. Check with the AI forum.
Muhammad Haggag
Muhammad Haggag
[Moved to: Artificial Intelligence]
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
To start with you can use just a simple ray/triangle test against your level data, from the eyepoint of your monsters to the centroid of your player. This will be fairly fast, but it won''t allow your monsters to see you if your butt is sticking out from behind a tree. A slightly better solution would be to project the players bounding box onto a parralelagram from the monsters point of view, and then do ray tests between the monsters eyepoint and the 4 corners of the parallelagram.
This would of course allow the monster to see you even if you are behind him, which is probably not desirable. In that case you get the normal of the eye direction, and the normal from the eye to the player, then find the angle between them, and if the angle is greater than say 70 or 80 degrees, the player is outside of the monsters peripheral vision.
Peace
This would of course allow the monster to see you even if you are behind him, which is probably not desirable. In that case you get the normal of the eye direction, and the normal from the eye to the player, then find the angle between them, and if the angle is greater than say 70 or 80 degrees, the player is outside of the monsters peripheral vision.
Peace
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement