# Fastest way to create colliders at runtime?

I’ve got a voxel engine that I’m trying to solve collision with, and it must use rigidbodies as these voxels can move & interact with the world dynamically - the voxels are used to build space ships. Once upon a time I used mesh colliders, which albeit were slow in conventional use were much faster for my voxel purposes. Now I’m using box colliders - I’ve tried adding components to my object, and I’ve tried instantiating child colliders. Both are horrendously slow when done enmasse as is needed for voxels… It causes a big hiccup every time I create a new object in the scene. I have moved to creating them in a coroutine, which is still not ideal as updates to the voxel collision can be delayed then.

Is there a faster method of adding box colliders to the scene that I’m missing or is my best option to move to custom collision detection using something such as SAT? I’m leaning towards a custom solution, though I’d like to avoid having to add on that additional dev time.

Hello, all i know is that the fatest collider is the circle or the sphere (simple Pythagore) but i know that rigidbody are very unefficient, i have a teacher that recreate the code of rigidbody each time he make a game x).
I don’t know very well how you game work but one way he told us game with one unit (like cube or voxel) is to make an double array named cubes in a GameManager and to register all position inside like this:

``````GameManager:
public GameObject[,] cubes;

Cube:
void start(){
cubes[position.x, position.y] = gameobject;
}

void update(){
if (Input.getKey(KeyCode.W))
if (cubes[position.x, position.y+1] is null){
cubes[position.x, position.y] = null;
cubes[position.x, position.y+1] = gameobject;
transform.translate(0,1);
}

}
``````