Voxel Engine Collision System

I’m designing collision system for my voxel engine. I have no experience with PhysX and Unity collisions. Please, evaluate my solution and possibly suggest improvements.

I plan to use only box colliders for terrain. The main idea is that I’m going to spawn one block size (1m) box colliders only when I need them. So for ex. when a character moves around I will spawn box colliders around it only in its close vicinity. When an item will be dropped to the ground only around it box colliders will be spawned. When characters or items disappear from an area I will remove those box colliders. To my knowledge box colliders are the fastest to create and manipulate. I will not scale or rotate them, only translate. Is this a sound idea? Maybe there is a better solution?

Well, the better solution is probably not to use PhysX colliders at all, but just do it yourself. It’s not hard to do when your world is made of blocks.

However, if for some reason you do need to use Unity’s engine, then this seems like a pretty good idea. Just keep in mind that it takes a frame for the physics engine to register new colliders (i.e., you can’t spawn a new collider and then immediately ask what is hitting it). Also, I’m not sure what the performance implications are of creating and destroying colliders all the time… it’s certainly not what the engine is optimized for, but I think it’s worth a try anyway.