Enhancing collision detection for level data
To speed up collision detection between instances and level geometry, we will create spatial partitioning for the level data, like the octree. But instead of adding the level triangles to the instance octree, we build a specialized octree for the triangle data alone.
Adding a new octree type
Using a separate data structure for level data makes more sense than trying to mix both data types in the existing octree for several reasons:
- The level data is static while the instance positions change frequently. We need to do costly updates to a quite heavily utilized octree on every instance position change, possibly resulting in a lot of additional split and merge operations when removing and re-adding the instances.
- The number of subdivisions for level data and instances may be completely different, depending on the level’s complexity and the number of instances. Having only a small number of instances roaming...