Hi, I know there are several other threads about this but I still can´t get it to work,
The player shoots rocket but they collide with him, the rockets spawn from a spawn point in front of the player but in higher speeds he runs into them. I have tried to set the Ignore Collision everywhere, on the rocket, on the player, in the script which fires the rockets(I have not set it on all of them simultaneously:P), but the problem is that I get a error which says “botch colliders need to be activated when calling this IgnoreCollision” I thought i would work if I put it in an Awake function on the rocket, but no.
Help is greatly appreciated, this is so frustrating.
have you tried using an array?
public GameObject spawnObject;
// Use this for initialization
void Start () {
GameObject Obj = (GameObject) Instantiate(spawnObject,transform.position, transform.rotation);
Obj.name = spawnObject.name;
GameObject[] spawnedObjects= GameObject.FindGameObjectsWithTag("Enemy");
foreach(GameObject s in spawnedObjects){
if (s!=Obj)
{
Physics.IgnoreCollision(Obj.collider,s.collider);
}
I used this for my 2 enemies to ignore collisions. you might have to unscramble it though
i understand what you do (mostly) but why use an array when i just want to Ignore collision between two objects, if it would be many different objects I definately see why this would be smart.
thanks for your answer, might use this if I won´t get any other answers.
You’ll need to show some code to show us how you attempted to ignore collision between the player and the rocket. Are you sure you’re not accidentally trying to ignore collisions between the rocket and the rocket spawn point (which probably doesn’t have a collider)?
thanks for your time but I solved it, by creating a variable of the created object var rocket = instantiate();
and then using the variable rocket in the IgnoreCollision it worked.