- Home /
how to Stop Enemys from clipping into eachother?
I have a 3d zombie arcade game, I want it to be more of a horde insted of one glitchy zombie with 300000 arms (get it their all clipped into eachother? because of the fallowing you nav thing). Heres my scrips for all my zombies, i really need help thanks!
using UnityEngine;
using System.Collections;
using UnityEngine.AI;
public class EnemyController : MonoBehaviour {
NavMeshAgent nav;
Transform player;
Animator Controller;
// Use this for initialization
void Awake () {
nav = GetComponent <NavMeshAgent> ();
player = GameObject.FindGameObjectWithTag ("Player").transform;
Controller = GetComponentInParent<Animator> ();
}
// Update is called once per frame
void Update () {
nav.SetDestination (player.position);
Controller.SetFloat ("speed", Mathf.Abs (nav.velocity.x + nav.velocity.z));
}
}
Comment
I suggest you this and if your scene has a lot of Zombies i recommend you to use scripted player follow rather then navmesh because sometimes if agents are many navmesh seems broken