Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

How do I keep enemies from overlapping

$
0
0
I am making a fps shooter so far I have 4 enemies when ever they chase the player they over lap. This is the code I am using ` //set the values in the inspector public Transform target; //drag and stop player object in the inspector public float within_range; public float speed; public void Update() { //get the distance between the player and enemy (this object) float dist = Vector3.Distance(target.position, transform.position); //check if it is within the range you set if (dist <= within_range) { //move to target(player) transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed); } //else, if it is not in rage, it will not follow player } ` Please Help

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>