How can i modify chase/detection range?

How would i go about if i want the enemy to detect me only if I am in his visual scope, i .e. i am more or less in front of him? My guess is raycasting but is there a way to make the raycasting realistic in a sense that it gets wider the further it is from the eyes? (As far as I know raycasting is basically a straight line going forward and looking for collisions.) Or there are other better coding solutions to this idea?

1 Like


First of all, you have to define what “visual score” and/or “in front of him” is. Neither your computer nor Unity know these words and concepts. The next step would be to check what Unity has and if you are able to use those things for your solution. A raycast could be a solution.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms