SpiderPig Posted September 13, 2023 Posted September 13, 2023 Not sure if this is a bug or not a good way to use the physics engine The box will still collide with the floor if you store it's collider elsewhere and set the boxes collider to nullptr. Are colliders unique to the object they are applied too? #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 framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); world->SetGravity(0.0f, -2.0f, 0.0f); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -8); camera->SetDebugPhysicsMode(true); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetMass(1.0f); box->SetColor(0, 1, 0); auto store = box->GetCollider(); box->SetCollider(nullptr);//Will still collide... auto floor = CreateBox(world, 10, .1, 10); floor->SetPosition(0, -2, 0); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
Solution Josh Posted September 13, 2023 Solution Posted September 13, 2023 Fixed 1 My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted September 14, 2023 Posted September 14, 2023 @SpiderPigThe lib has been updated with this fix now. 1 My job is to make tools you love, with the features you want, and performance you can't live without.
SpiderPig Posted September 14, 2023 Author Posted September 14, 2023 Thankyou the example now works. However there is a new issue - it appears if you set a collider to nullptr when the mass is zero the program will crash. Comment out this line and it will crash. // box->SetMass(1.0f); 1
Josh Posted September 14, 2023 Posted September 14, 2023 What would I do without @SpiderPig? 1 1 My job is to make tools you love, with the features you want, and performance you can't live without.
SpiderPig Posted September 15, 2023 Author Posted September 15, 2023 Just wondering if you've had a chance to look at this yet? None of my projects work at the moment.
Josh Posted September 15, 2023 Posted September 15, 2023 Yeah, it's fixed, I just have not updated the lib. I'll do it within a couple hours from now. 1 My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted September 16, 2023 Posted September 16, 2023 The fix is up now. 1 My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts