Enemy attack radius
I have a question and hope someone can help me.
I'm currently Working on an Pixel-Top Down-Survival Game (3D) and want that an Enemy follows me and attacks me if i walk into a (maby) invisible radius.
Thanks for helping ! LG Stephan
Your question was already answered here. Why are you posting a duplicate?
Answer by SoulGameStudio · Jan 19, 2016 at 04:50 PM
http://docs.unity3d.com/ScriptReference/Vector3.Distance.html
This page in the doc will show you how to calculate the distance between two objet. Using that you can check if that distance is inferior to your enemy "field of view" and that will do.
If you don't know how to make an enemy following you, I suggest to checkout this tutorial : http://unity3d.com/learn/tutorials/projects/survival-shooter/environment?playlist=17144