- Home /
Ignore Collision for 2d Collider
I want to ignore collision between two objects for my 2D game.
In 3D game, I used following statement to ignore collision
public Transform target; //Middle parent joint
void Start()
{
// to prevent collision with the middle sphere collider
Physics.IgnoreCollision(target.collider, collider);
}
But now I have BoxCollider2D and Physics2D class. So what is the way to ignore collision?
Answer by Aridez · Feb 18, 2014 at 01:33 PM
Currently this is a requested feature that might be under development already: http://forum.unity3d.com/threads/212706-Physics2D-Ignore-Collision-between-Collider2D
Meanwhile you can ignore collision between two objects on different layers using the layer collision matrix on edit -> project settings -> physics2d and unchecking the collision you dont want to happen, it's not as good as Physics.IgnoreCollision but can be a workaround if it's not a complex thing.
Thanks for this information. At present I am not marking this answer as correct but later on if you found correct code similar to above then paste it.