Only top-level entities are returned, so the bounds used is the recursive bounds that includes all children. This code shows it is working correctly:
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[]) {
auto displays = GetDisplays();
auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
auto world = CreateWorld();
auto framebuffer = CreateFramebuffer(window);
auto camera = CreateCamera(world);
camera->SetClearColor(0.125);
camera->SetPosition(0, 0, -3);
auto light = CreateBoxLight(world);
light->SetRotation(45, 35, 0);
light->SetRange(-10, 10);
light->SetColor(2);
auto prefab = LoadPrefab(world, "WallLight3.pfb");
auto bounds = prefab->GetBounds(BOUNDS_RECURSIVE);
Vec3 realPosition(10, 0, 10);
float radius = 0.8f;
Vec3 positionLower = realPosition;
positionLower.x = positionLower.x - radius;
positionLower.z = positionLower.z - radius;
positionLower.y = positionLower.y - radius;
Vec3 positionUpper = realPosition;
positionUpper.x = positionUpper.x + radius;
positionUpper.z = positionUpper.z + radius;
positionUpper.y = positionUpper.y + radius;
auto bounds2 = Aabb(positionLower, positionUpper);
Print(bounds2.IntersectsAabb(bounds));
return 0;
for (auto& foundEntity : world->GetEntitiesInArea(positionLower, positionUpper)) {
Print(foundEntity->name + " found");
}
//Main loop
while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) {
world->Update();
world->Render(framebuffer);
}
return 0;
}