I'm trying to do a very basic thing, have my turret not collide with the missiles it's launching. Missile is a prefab reference.
GameObject missile = (GameObject)Instantiate(Missile, centerTube.position, centerTube.rotation);
BoxCollider turretCollider = transform.Find("Ball").GetComponent<BoxCollider>();
Physics.IgnoreCollision(turretCollider, missile.collider);
The "Ball" child object is what the collider that's causing problems is actually attached to. There is another collider on the main GameObject but it's a trigger and used for activating the firing of the turret. Could having two colliders on different parts of a prefab hierarchy be causing issues? I've tried everything I can think of, even adding this to my Missile's behavior.
public void OnCollisionEnter(Collision other) {
if(null != other.collider) {
Physics.IgnoreCollision(collider, other.collider);
}
}
But the instantiated missile is still effected by the box collider. Of course, turning that collider into a trigger makes everything work fine, no more collisions, but then that breaks everything else. Any ideas?