Take something like a tanks game with a small turret in the middle of a large tank so the barrel is always inside the tank’s collider. When the tank fires, the shell launches within its bounds. How do we ensure it can’t collide with the tank in 2D physics but can collide with everything else until it’s past the tank’s collider (ricochets back)? I’m looking for something like a Physics2D.IgnoreCollision as described for 3D physics in the manual -
…but there doesn’t appear to be a way to exclude certain rigidbody interactions in 2D unless I’m missing something.
That’s a near impossibility, or crazy complication. I have ‘tanks’ that shoot ‘shells’. I want the shells to hit tanks, naturally. If I move the player to a different layer so it isn’t hit by its ‘shells’, it won’t get hit by any shells. So then I have the player’s shells on a different layer to other shells, okay. But then I need two layers for every single player, whether bot or player. That’s crazy!!
The inability to exclude certain collisions makes many game types pretty much impossible with Unity’s 2D implementation. Space Invaders may be okay, but anything more complex is screwed. Really not sure what to do now. My game was going along swimmingly until just now when some types of long shots were coming out rotated, which I finally tracked down to a self collision. Given no ETA on a fix for this feature, should I spend my time refactoring the entire game to 3D and take the performance hit? Or launch every shot from a circle around the player where it can’t self collide instead of where it should be?