Dreikblack Posted February 8 Share Posted February 8 No error windows or in consoles, just app closing when GetDistance called. Need this working for tutorial local displays = GetDisplays(); --Create a window local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR) --Create a framebuffer local framebuffer = CreateFramebuffer(window) --Create a world local world = CreateWorld() --Create a camera local camera = CreateCamera(world) local distanceToTarget = camera:GetDistance(Vec3(1,1,1)) Print(distanceToTarget) --Main loop while not window:Closed() and not window:KeyDown(KEY_ESCAPE) do world:Update() world:Render(framebuffer) end Quote Link to comment Share on other sites More sharing options...
Josh Posted Tuesday at 05:25 AM Share Posted Tuesday at 05:25 AM Can confirm with this onl-kineer in the editor console... box = CreateBox(nil) box:GetDistance(Vec3(0,0,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...
Josh Posted Tuesday at 05:42 AM Share Posted Tuesday at 05:42 AM I am perplexed. There seems to be nothing odd about the way the method is declared... "GetDistance", sol::overload( [](Entity& e, shared_ptr<Entity> b) { return e.GetDistance(b); }, [](Entity& e, Vec3 b) { return e.GetDistance(b); }, [](Entity& e, float x, float y, float z) { return e.GetDistance(x, y, z); } ), 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...
Solution Josh Posted Tuesday at 05:50 AM Solution Share Posted Tuesday at 05:50 AM Okay, when I declared the entity overload as a pointer it is able to find the right method. "GetDistance", sol::overload( [](Entity& e, Entity* b) { std::shared_ptr<Entity> ee; if (b) ee = b->As<Entity>(); if (not ee) return 0.0f; return e.GetDistance(ee); }, [](Entity& e, Vec3 b) { return e.GetDistance(b); }, [](Entity& e, float x, float y, float z) { return e.GetDistance(x, y, z); } ), This will not be in the first update tomorrow, because that update is already uploaded and ready to go. 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.