- Home /
Calling out where targets are based on environment and direction?
Similar to COD's way of soldiers calling out where targets are ("Twelve o' clock", or "by those barrels!"), Would I use a ray cast in order to detect the target direction or to detect whether that target is next to a barrel or a staircase (I would assume you would use tags to determine if something is a barrel or staircase)
Answer by AlwaysSunny · Dec 29, 2016 at 06:20 AM
That might work, though it sounds pretty failure-prone.
I suspect the "big studios" actually do this with trigger volumes. If the player is standing within a volume, the AI can reference audio clips that refer to those volumes by name. It's an extra layer of complexity during the map design phase, but I imagine it'll work much more reliably than raycasts and tag checks. Computationally cheaper, too.
Establishing direction can be as simple as an angle check between the agent's forward direction versus the player's position, so that's an easy one.
Yeah, I suspected raycasts wouldn't be the best way. Heck, I haven't even thought of volumes. Thanks for the help! (Although I will leave this open in case any other users want to share their answer as well!) :D
Your answer
![](https://koobas.hobune.stream/wayback/20220612103618im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
[C#] Raycasts and Object Tags 1 Answer
AI Field of vision 1 Answer
Another Raycast Issue. 0 Answers
Finding RayCastHit's Origin Position 2 Answers
Implementing BUG2 algorithm 0 Answers