My game objects, zombies, are merging when they all plot the same path to the player. I have both box colliders and capsule colliders on them but it doesn’t work. Is it because their copies?
Here is my script so far:
var target : Transform; //the enemy's target
var moveSpeed = 2; //move speed
var rotationSpeed = 0.5; //speed of turning
var myTransform : Transform; //current transform data of this enemy
function Awake()
{
myTransform = transform; //cache transform data for easy access/preformance
}
function Start()
{
target = GameObject.FindWithTag("FirstPersonCharacter").transform; //target the player
}
function Update () {
//rotate to look at the player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
//move towards the player
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}