var speed = 5;
private var moveDirection : Vector3;
private var startDirection : int;
private var zombies : GameObject;
function Start () {
moveDirection = Vector3(speed,0,0);
startDirection = Random.Range(1,3);
if(startDirection == 1){
right = true;
}
else{
right = false;
}
zombies = GameObject.FindWithTag ("Zombie");
Physics.IgnoreCollision(zombies.collider, collider);
}
It works once, but after it sets the “zombies” variable it stops searching and collides normally with the other zombies. How can i ignore collisions with ALL objects with the tag Zombie?
You can put all your objects that you want them to ignore each other on the same custom layer. Then in your Physics Manager, just uncheck it to make your objects ignore collisions if both them and the object they are colliding with is on the same custom layer. More info here: Unity - Manual: Physics
Function Start () only runs ones, move it to a customfunction and call it from function Update () when you need it.
Also whatwolfhunter says about using a layer is the best way or using a tag you check onCollision.