Octree and ECS, tracking objects


Hello, it’s been a long time since I could get time to continue working with amethyst and rust, so I’m here again and wanted to understand what’s are the best approaches to track objects that are currently active using octree.

Ok, let me explain exactly what I need/want, I currently have an octree where I store all my objects, and what I want is to render all objects that are near the camera (aka player), so in order to do this I query the octree and (this is how I was thinking to approach but I think isn’t a good approach or maybe is) create entities with each of them, then load/create the meshes and render them, but what I find a bit awkward is that in order to this to work each time that the user moves a certain distance I query again the octree, get a list of the objects, then get the list from ecs of the entities that has those objects and remove the entities that are not in the list, and add the new ones (the existing ones I leave as it).

Is this approach ok, or there is a better ecs way to do this?


1 Like