I’m trying to do a simple space shooter and I want the different ships to collide with each other. The ships are sprites. For this I wanted to use an edge collider on the ships.
But the ships don’t collide with each other. Neither the rigidbody2d reacts, nor does the OnCollisionEnter2D function run.
If I shoot at them, the bullets collide just fine. But the bullets have Circle-Colliders. If I use box colliders instead of edge colliders it works fine with the ships too.
I’ve already tried setting the collision detection to “Continuous” but that didn’t help. My scale is at 1, so I think that shouldn’t be a problem either.
I’m using Unity 4.6, but I don’t think it has something to do with the beta.
Do you have any suggestions?
Edge colliders do not collide with each other. Straight from the Box2D manual (Unity 2D physics uses Box2D):
“A major limitation of edge shapes is that they can collide with circles and polygons but not with themselves. The collision algorithms used by Box2D require that at least one of two colliding shapes have volume. Edge shapes have no volume, so edge-edge collision is not possible.”
Maybe convert them into Polygon2D colliders.
IF you need the other edge collider just put a simple box or circle or any other collider just inside of the edge collider so the edger collider can perform its functions with any other collider and the box can perform its functions with edge… I know im a little late XD but at least I can help other people who come across this.,I had the same problem but if want to put a box collider or other colliders just inside of the edge collider so you can keep your edge collider if you need it for other things