Now…
Basically, I had an “amazing idea™” to roll out my own collision detection system that would work in 2d, like original doom did.
Doom I has 2d collision detection where your bullets autoaim vertically. Meaning you can’t just 3d raycast int. Another problem is 2d map you can see in doom overlay, which tracks sector and wall visibility. So, I made a wrong decision and tried to roll out 2d collision system that would deal with both of those issues.
XYZ hours later I got a grid based colision detection in 2d that took handled collisions with level, collisions between objects and the level, and collision between enemeis as well. Also, it could return current 2d polygon in the scene for any map coordinate:

^^^ Object’s pushed away from initial position by collision detection system.
Grid based means that there was a 2d grid and each grid cell stored polygons/edges that were located in it, plus objects upon moving would register/deregister themselves from the grid cells. The issue with this and BSP approach is that BSP takes significantly less space for polygons.
Now… then I hit problems.
First, because Doom character moves around at 50 kmph or somethign along thise lines, the character could easily tunnel through thin walls. Also, it could tunnel through not so thin walls and end up outside of the level, if the move would place him into another cell that didn’t have any grid registered in it.
But the big problem is that on larger levels I got very choppy performance, because of garbage generation (which I actually tried to minimize).
So, I took a hard look at the whole mess, sighed, put it into “Obsolete” folder and then set up replacemenet with rigidbodies in one hours or so.
So, lessons learned:
- Apparently C# in unity is very bad choice when dealing with large number of containers. The system I had would work just fine in C++, due to tight memory control.
- Rolling out your own collision in untiy is generaly a bad idea. It is a FUN idea to tinker with, jsut not a good one.
Well, I did get some sort of fun coding warm-up with it, and figured out a routine that can shoot 2d raycast through poly grid by walking through adjacency information. This one will be probably used for 2d map, when I get to it.
But the whole “let’s handle ALL collision on our own” was a massive waste of time and nothing more.