Dreikblack Posted July 24 Share Posted July 24 Prefab: WallLight3.zip #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"); 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; 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; } Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted July 24 Author Share Posted July 24 Probably related to point lights, no problems with other prefabs so far Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted Wednesday at 05:50 PM Solution Share Posted Wednesday at 05:50 PM 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; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Dreikblack Posted Thursday at 02:38 AM Author Share Posted Thursday at 02:38 AM Well, then it's just light having bounds radius as their range? It's not what i expect when i do GetEntitiesInArea() and would prefer light bounds being a point when i do GetEntitiesInArea Quote Link to comment Share on other sites More sharing options...
Josh Posted Thursday at 02:40 AM Share Posted Thursday at 02:40 AM The light bounds are important because it is used to determine what objects the light interacts with, like for triggering a refresh of the shadow. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Dreikblack Posted Thursday at 02:44 AM Author Share Posted Thursday at 02:44 AM Can be added option to ignore children aabb for GetEntitiesInArea? Quote Link to comment Share on other sites More sharing options...
Josh Posted Thursday at 03:03 AM Share Posted Thursday at 03:03 AM No, but it is simple enough to add a post-processing step for the list: std::vector<shared_ptr<Entity> > newlist; for (auto entity : entities) { if (not entity->GetBounds(BOUNDS_GLOBAL).IntersectsAabb(bounds)) continue; newlist.push_back(entity); } 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.