Download

Is a TOctree of Box Colliders bad for performance ?

Hello everyone,

I’m actually working on a game project, where I decided to put a very large collision box on the player character. The idea is to detect any object that get into it, and I want to calculate a “score” representing how much space it’s occupying in that collision box.

In order to achieve this, I thought I would create an entire 8x8x8 Octree of small box colliders. For the sake of simplicity, we’ll say that each of them returns 0 if there is nothing inside and 1 if there is an object inside.

https://forums.unrealengine.com/filedata/fetch?filedataid=124952&type=thumb

In this example above, the red circle would get a score of 30 points, while the blue circle would get a score of 1 point.
While this approach may work in a way, I got a bad feeling about the performance, as this uses up to 512 collision boxes at once.

Does such a thing have negative impact on performance ? If that’s the case, is there a better way of doing what i’m trying to do, even without using Octrees ?

Thank you in advance