ok, I have a room full of zombies but they cant get out of the door because they collide with eachother and jam the door. does anybody know how I can get around this?
@Feyhu
I had a similar problem with a previous project. What I did was I put the enemies on a layer and had the enemies ignore the layer.
Hope that helps,
-S
Or you could use Pysics.IgnoreCollision an simply ignore collisions between all enemys!
I cant figure out how to get it working for multiple zombies from the same prefab.
I keep getting:
Assets/Scripts/EnemyCollision.cs(13,17): error CS0117: UnityEngine.Physics' does not contain a definition for IgnoreLayerCollision’
Urgent bump!
Can you post the script that’s generating the error, and also indicate which line generates the error?
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Physics.IgnoreLayerCollision(Enemy.collider, Enemy.collider);
}
}
bump… again, need it done by midnight, please help
I had the same issue and put all of the enemies and their bullets on layers that are ignoring each other under Edit->Project Settings->Physics.
I also had an issue where I needed to dynamically have the player ignore an entire set of collisions, then an entirely different set of collisions. Doing this for each object would suck, so I set up layers that get toggled.
the code snippet goes like this:
if(redEmp) {
Physics.IgnoreLayerCollision(10,11,true);
Physics.IgnoreLayerCollision(10,12,false);
Physics.IgnoreLayerCollision(10,13,false);
Physics.IgnoreLayerCollision(10,14,false);
}
It’s very brute force, but works. Note IgnoreLayerCollsion only seems to work with numbers.
Hope that helps.
same problem, doesnt have a definition for IgnoreLayerCollision
Upgrade to Unity 3.
–Eric
but but but… will it require changing any of my scripts?
Maybe, it depends on what you’ve used.
–Eric
Insert a random variable named More_Than_A_Feeling, the powers of Boston work in mysterious ways
quit spamming josh
Sorry man, I had to, but did you even try it? You never know
wow, a soon a i saw “more than” I knew you were referring to boston
If you’re not using Unity 3 and if upgrading will make it difficult to finish your project on time, take a look at Physics.IgnoreCollision(). You’ll have to specify each pair of objects for which you want collisions to be ignored, but if you have a fixed set of objects that you don’t want to interact with each other, this can be done with a simple nested loop.
I will use unity 3…
got it, thanks guys