How to give Godot and super increase in speed in the physics engine. First I will explain the problem Godot has, as do all physics engines at the time of writing this. Then, I will explain a solution to the problem.
Right now Godot’s physics engine tests each object against every object in the scene. The more objects in the scene, the slower it goes when moving something. I know a way to test those moved objects only with what is close to them. Nothing else gets scanned or checked.
A grid. Let me explain each part of this thing. The grid has four corners. Each corner is represented by 4 vertices. This says where the grid is placed in 3d space. Each grid has a list of objects. The objects the grid lists are the one’s in the same space. This way, when an object moves, it is only tested with what’s listed in the grid it occupies. An object can occupy more than one grid.
Now, it would be slow to test the bounding box the object to see what grids it falls into. But I know how to do direct memory mapping for that grid.
Lets go back to the grid. The grid is a perfect size, of (10,10,10). That is how big one grid block is. We will use an imaginary space of 100,100,100 grid blocks. That covers a huge area, and there is many of them. Now, we will take an array of pointers, array[100,100,100]. This array of pointers point to each grid block. To find the direct mapping for that array, you take the vertice and do division on it. Lets say the vertice is at (82.5,82.5,82.5) cordinate. 82.5/10=8.25. This means it occupies grid (8,8,8). Straight to the grid. You only remove the decimal. This is easy with, int = float;
The idea is to reduce the amount of calculations being done, by only doing them on what might be needed.
I don’t have a name for it. Has this been done before?